Compare commits
No commits in common. "0a1bffe8f8bfa7f612a89a9460aae04c14fc9594" and "b4b7eac73c4121843d4890062eae2794a6815da6" have entirely different histories.
0a1bffe8f8
...
b4b7eac73c
@ -2,6 +2,6 @@ import { defineConfig } from '@hey-api/openapi-ts';
|
||||
|
||||
export default defineConfig({
|
||||
client: '@hey-api/client-axios',
|
||||
input: 'http://localhost:10500/swagger/AbpPro/swagger.json',
|
||||
input: 'http://localhost:44315/swagger/AbpPro/swagger.json',
|
||||
output: 'src/api-client',
|
||||
});
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
export * from './schemas.gen';
|
||||
export * from './services.gen';
|
||||
export * from './types.gen';
|
||||
export * from './types.gen';
|
||||
|
||||
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
@ -77,7 +77,7 @@
|
||||
"loginMode": "Login Method",
|
||||
"loginUrl": "Login URL",
|
||||
"detail": "Details",
|
||||
"dataBaseName": "Database Name",
|
||||
"systemName": "System Name",
|
||||
"projectId": "Project ID",
|
||||
"dataType": "Data Type",
|
||||
"deviceType": "Device Type",
|
||||
@ -210,7 +210,6 @@
|
||||
},
|
||||
"IoTDBBase": {
|
||||
"IoTDataType": "IoTDataType",
|
||||
"DataBaseName": "DataBaseName",
|
||||
"DeviceType": "DeviceType",
|
||||
"Timestamps": "Timestamps",
|
||||
"FormattedTimestamps": "Formatted Timestamps",
|
||||
|
||||
@ -77,7 +77,7 @@
|
||||
"loginMode": "登录方式",
|
||||
"loginUrl": "登录地址",
|
||||
"detail": "详情",
|
||||
"dataBaseName": "数据库名称",
|
||||
"systemName": "系统名称",
|
||||
"projectId": "项目编码",
|
||||
"dataType": "数据类型",
|
||||
"deviceType": "设备类型",
|
||||
@ -210,7 +210,6 @@
|
||||
},
|
||||
"IoTDBBase": {
|
||||
"IoTDataType": "数据类型",
|
||||
"DataBaseName": "所属数据库",
|
||||
"DeviceType": "设备类型",
|
||||
"Timestamps": "时标(纳秒)",
|
||||
"FormattedTimestamps": "时标",
|
||||
|
||||
@ -12,10 +12,10 @@ import { message as Message, Modal, Tag } from 'ant-design-vue';
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
postDeviceInfoPage,
|
||||
postAggregationDeviceDeleteAsync,
|
||||
postDeviceInfoPage,
|
||||
postAggregationDeviceCreateAsync,
|
||||
postMetersCreate,
|
||||
postMetersDelete,
|
||||
postMetersPage,
|
||||
postMetersUpdate,
|
||||
} from '#/api-client';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
import { $t } from '#/locales';
|
||||
@ -55,7 +55,7 @@ const gridOptions: VxeGridProps<any> = {
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
const { data } = await postDeviceInfoPage({
|
||||
const { data } = await postMetersPage({
|
||||
body: {
|
||||
pageIndex: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
@ -119,8 +119,7 @@ const [EditForm, editFormApi] = useVbenForm({
|
||||
async function submit() {
|
||||
const isEdit = !!editRow.value.id;
|
||||
const formApi = isEdit ? editFormApi : addFormApi;
|
||||
// TODO: 需要确认设备更新接口,暂时使用创建接口
|
||||
const api = postAggregationDeviceCreateAsync;
|
||||
const api = isEdit ? postMetersUpdate : postMetersCreate;
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) return;
|
||||
|
||||
@ -165,7 +164,7 @@ function onDel(row: any) {
|
||||
Modal.confirm({
|
||||
title: `${$t('common.confirmDelete')}${row.meterName} ?`,
|
||||
onOk: async () => {
|
||||
const result = await postAggregationDeviceDeleteAsync({ body: { id: row.id } });
|
||||
const result = await postMetersDelete({ body: { id: row.id } });
|
||||
if (result) {
|
||||
gridApi.reload();
|
||||
Message.success($t('common.deleteSuccess'));
|
||||
|
||||
@ -12,10 +12,10 @@ import { message as Message, Modal, Tag } from 'ant-design-vue';
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
postDeviceInfoPage,
|
||||
postAggregationDeviceDeleteAsync,
|
||||
postDeviceInfoPage,
|
||||
postAggregationDeviceCreateAsync,
|
||||
postMetersCreate,
|
||||
postMetersDelete,
|
||||
postMetersPage,
|
||||
postMetersUpdate,
|
||||
} from '#/api-client';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
import { $t } from '#/locales';
|
||||
@ -55,7 +55,7 @@ const gridOptions: VxeGridProps<any> = {
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
const { data } = await postDeviceInfoPage({
|
||||
const { data } = await postMetersPage({
|
||||
body: {
|
||||
pageIndex: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
@ -119,8 +119,7 @@ const [EditForm, editFormApi] = useVbenForm({
|
||||
async function submit() {
|
||||
const isEdit = !!editRow.value.id;
|
||||
const formApi = isEdit ? editFormApi : addFormApi;
|
||||
// TODO: 需要确认设备更新接口,暂时使用创建接口
|
||||
const api = postAggregationDeviceCreateAsync;
|
||||
const api = isEdit ? postMetersUpdate : postMetersCreate;
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) return;
|
||||
|
||||
@ -165,7 +164,7 @@ function onDel(row: any) {
|
||||
Modal.confirm({
|
||||
title: `${$t('common.confirmDelete')}${row.meterName} ?`,
|
||||
onOk: async () => {
|
||||
const result = await postAggregationDeviceDeleteAsync({ body: { id: row.id } });
|
||||
const result = await postMetersDelete({ body: { id: row.id } });
|
||||
if (result) {
|
||||
gridApi.reload();
|
||||
Message.success($t('common.deleteSuccess'));
|
||||
|
||||
@ -13,10 +13,10 @@ import { useVbenForm } from '#/adapter/form';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
postDeviceInfoArchivesDown,
|
||||
postAggregationDeviceCreateAsync,
|
||||
postAggregationDeviceDeleteAsync,
|
||||
postDeviceInfoCreate,
|
||||
postDeviceInfoDelete,
|
||||
postDeviceInfoPage,
|
||||
postAggregationDeviceFindByIdAsync,
|
||||
postDeviceInfoUpdate,
|
||||
} from '#/api-client';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
import { $t } from '#/locales';
|
||||
@ -120,8 +120,7 @@ const [EditForm, editFormApi] = useVbenForm({
|
||||
async function submit() {
|
||||
const isEdit = !!editRow.value.id;
|
||||
const formApi = isEdit ? editFormApi : addFormApi;
|
||||
// TODO: 需要确认设备更新接口,暂时使用创建接口
|
||||
const api = postAggregationDeviceCreateAsync;
|
||||
const api = isEdit ? postDeviceInfoUpdate : postDeviceInfoCreate;
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) return;
|
||||
|
||||
@ -166,7 +165,7 @@ function onDel(row: any) {
|
||||
Modal.confirm({
|
||||
title: `${$t('common.confirmDelete')}${row.meterName} ?`,
|
||||
onOk: async () => {
|
||||
const result = await postAggregationDeviceDeleteAsync({ body: { id: row.id } });
|
||||
const result = await postDeviceInfoDelete({ body: { id: row.id } });
|
||||
if (result) {
|
||||
gridApi.reload();
|
||||
Message.success($t('common.deleteSuccess'));
|
||||
@ -184,7 +183,7 @@ const toStatusData = (row: Record<string, any>) => {
|
||||
DeviceType: row.meterType,
|
||||
DeviceId: row.meterId,
|
||||
FocusAddress: row.focusAddress,
|
||||
DataBaseName: row.businessSystemName,
|
||||
SystemName: row.businessSystemName,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@ -21,7 +21,7 @@ CTWing日志管理页面用于查看和管理CTWing物联网平台的设备数
|
||||
DeviceType?: string, // 设备类型
|
||||
DeviceId?: string, // 设备ID
|
||||
FocusAddress?: string, // 集中器地址
|
||||
DataBaseName?: string, // 数据库名称
|
||||
SystemName?: string, // 系统名称
|
||||
ProjectId?: string // 项目ID
|
||||
}
|
||||
```
|
||||
@ -32,7 +32,7 @@ CTWing日志管理页面用于查看和管理CTWing物联网平台的设备数
|
||||
{
|
||||
items: [
|
||||
{
|
||||
dataBaseName: string, // 数据库名称
|
||||
systemName: string, // 系统名称
|
||||
projectId: string, // 项目ID
|
||||
dataType: string, // 数据类型
|
||||
deviceType: string, // 设备类型
|
||||
@ -74,7 +74,7 @@ CTWing日志管理页面用于查看和管理CTWing物联网平台的设备数
|
||||
|
||||
| 字段名 | 显示名称 | 说明 |
|
||||
| ---------------- | ---------- | ------------------ |
|
||||
| dataBaseName | 数据库名称 | 所属数据库 |
|
||||
| systemName | 系统名称 | 所属系统 |
|
||||
| projectId | 项目编码 | 项目标识 |
|
||||
| dataType | 数据类型 | 数据类型 |
|
||||
| deviceType | 设备类型 | 设备类型 |
|
||||
|
||||
@ -8,8 +8,7 @@ import { useRoute } from 'vue-router';
|
||||
import { Page } from '@vben/common-ui';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { postDeviceInfoPage } from '#/api-client';
|
||||
import { postCTWingLogInfoPage } from '#/api-client';
|
||||
import { postCTWingLogInfoPage, postMetersPage } from '#/api-client';
|
||||
|
||||
import DeviceSelect from '../deviceData/DeviceSelect.vue';
|
||||
import { querySchema, tableSchema } from './schema';
|
||||
@ -33,7 +32,7 @@ const deviceOptions = ref<any[]>();
|
||||
// 获取设备信息的完整数据
|
||||
const fetchDeviceOptions = async () => {
|
||||
try {
|
||||
const { data } = await postDeviceInfoPage({
|
||||
const { data } = await postMetersPage({
|
||||
body: {
|
||||
pageIndex: 1,
|
||||
pageSize: 1000,
|
||||
@ -140,7 +139,7 @@ const formOptions: VbenFormProps = {
|
||||
'EndCreationTime',
|
||||
'IoTDataType',
|
||||
'StartCreationTime',
|
||||
'DataBaseName',
|
||||
'SystemName',
|
||||
]);
|
||||
const hasRelevantChange = changedFields.some((field) =>
|
||||
relevantFields.has(field),
|
||||
@ -184,7 +183,7 @@ const gridOptions: VxeGridProps<any> = {
|
||||
|
||||
// 获取选中的设备信息
|
||||
let deviceId = currentFormValues.DeviceId || '';
|
||||
let dataBaseName = '';
|
||||
let systemName = '';
|
||||
const deviceType = currentFormValues.DeviceType || '';
|
||||
|
||||
// 优先使用选中的设备信息
|
||||
@ -195,7 +194,7 @@ const gridOptions: VxeGridProps<any> = {
|
||||
: null);
|
||||
|
||||
if (deviceInfo) {
|
||||
dataBaseName = deviceInfo.businessSystemName || '';
|
||||
systemName = deviceInfo.businessSystemName || '';
|
||||
// 根据设备类型获取正确的 id
|
||||
if (Number(deviceType) === 10) {
|
||||
// 集中器类型使用 focusId
|
||||
@ -213,7 +212,7 @@ const gridOptions: VxeGridProps<any> = {
|
||||
DeviceType: deviceType,
|
||||
IoTDataType: currentFormValues.IoTDataType || '',
|
||||
DeviceId: deviceId,
|
||||
DataBaseName: dataBaseName || currentFormValues.DataBaseName || '',
|
||||
SystemName: systemName || currentFormValues.SystemName || '',
|
||||
StartCreationTime: formatDate(currentFormValues.StartCreationTime),
|
||||
EndCreationTime: formatDate(currentFormValues.EndCreationTime),
|
||||
FocusAddress: currentFormValues.FocusAddress || '',
|
||||
|
||||
@ -4,20 +4,19 @@ import { computed } from 'vue';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { getCommonGetSelectList } from '#/api-client';
|
||||
import { getSelectResultList } from '#/api-client';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
export const querySchema = computed(() => [
|
||||
{
|
||||
component: 'ApiSelect',
|
||||
fieldName: 'DataBaseName',
|
||||
label: $t('abp.IoTDBBase.DataBaseName'),
|
||||
fieldName: 'SystemName',
|
||||
label: $t('abp.IoTDBBase.SystemName'),
|
||||
componentProps: {
|
||||
api: getCommonGetSelectList,
|
||||
api: getSelectResultList,
|
||||
params: {
|
||||
query: {
|
||||
typeName: 'BusinessSystemEnum'
|
||||
|
||||
TypeName: 'BusinessSystemEnum',
|
||||
},
|
||||
},
|
||||
labelField: 'secondValue',
|
||||
@ -47,10 +46,10 @@ export const querySchema = computed(() => [
|
||||
fieldName: 'DeviceType',
|
||||
label: $t('abp.IoTDBBase.DeviceType'),
|
||||
componentProps: {
|
||||
api: getCommonGetSelectList,
|
||||
api: getSelectResultList,
|
||||
params: {
|
||||
query: {
|
||||
typeName: 'MeterTypeEnum'
|
||||
TypeName: 'MeterTypeEnum',
|
||||
},
|
||||
},
|
||||
labelField: 'value',
|
||||
@ -80,12 +79,10 @@ export const querySchema = computed(() => [
|
||||
fieldName: 'IoTDataType',
|
||||
label: $t('abp.IoTDBBase.IoTDataType'),
|
||||
componentProps: {
|
||||
api: getCommonGetSelectList,
|
||||
api: getSelectResultList,
|
||||
params: {
|
||||
query: {
|
||||
input: {
|
||||
typeName: 'IoTDBDataTypeConst',
|
||||
},
|
||||
TypeName: 'IoTDBDataTypeConst',
|
||||
},
|
||||
},
|
||||
labelField: 'value',
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import { ref, computed } from 'vue';
|
||||
import { Select, Divider, Row } from 'ant-design-vue';
|
||||
import { ChevronLeft, ChevronRight } from '@vben/icons';
|
||||
import { postDeviceInfoPage } from '#/api-client';
|
||||
import { postMetersPage } from '#/api-client';
|
||||
import { $t } from '#/locales';
|
||||
import { useDebounceFn } from '@vueuse/core';
|
||||
|
||||
@ -49,7 +49,7 @@ const maxPage = computed(() => {
|
||||
const fetchData = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
const { data } = await postDeviceInfoPage({
|
||||
const { data } = await postMetersPage({
|
||||
body: {
|
||||
pageIndex: query.value.pageIndex,
|
||||
pageSize: query.value.pageSize,
|
||||
|
||||
@ -63,7 +63,7 @@ if (data?.items && data.items.length > 0) {
|
||||
```typescript
|
||||
// 在 dynamicColumns.ts 中添加字段映射
|
||||
export const fieldNameMapping: FieldMapping = {
|
||||
DataBaseName: '数据库名称',
|
||||
SystemName: '系统名称',
|
||||
ProjectId: '项目ID',
|
||||
// 添加新的字段映射
|
||||
CustomField: '自定义字段',
|
||||
@ -96,7 +96,7 @@ export const fieldTypeConfig: FieldTypeConfig = {
|
||||
|
||||
| 字段名 | 显示名称 | 说明 |
|
||||
|--------|----------|------|
|
||||
| DataBaseName | 数据库名称 | 数据库名称字段 |
|
||||
| SystemName | 系统名称 | 系统名称字段 |
|
||||
| ProjectId | 项目ID | 项目标识符 |
|
||||
| ProjectName | 项目名称 | 项目名称 |
|
||||
| IoTDataType | IoT数据类型 | 数据类型标识 |
|
||||
@ -124,7 +124,7 @@ export const fieldTypeConfig: FieldTypeConfig = {
|
||||
// 固定列定义
|
||||
const fixedColumns = computed(() => [
|
||||
{ title: '序号', type: 'seq', width: 50 },
|
||||
{ field: 'DataBaseName', title: '数据库名称', width: 150 },
|
||||
{ field: 'SystemName', title: '系统名称', width: 150 },
|
||||
]);
|
||||
|
||||
// 动态列
|
||||
@ -142,9 +142,9 @@ const allColumns = computed(() => [
|
||||
```typescript
|
||||
import { sortFieldsByImportance } from './example';
|
||||
|
||||
const fields = ['CustomField', 'Timestamps', 'DataBaseName'];
|
||||
const fields = ['CustomField', 'Timestamps', 'SystemName'];
|
||||
const sortedFields = sortFieldsByImportance(fields);
|
||||
// 结果: ['Timestamps', 'DataBaseName', 'CustomField']
|
||||
// 结果: ['Timestamps', 'SystemName', 'CustomField']
|
||||
```
|
||||
|
||||
### 3. 数据验证
|
||||
|
||||
@ -7,12 +7,12 @@ import type {
|
||||
|
||||
// 字段名映射配置
|
||||
export const fieldNameMapping: FieldMapping = {
|
||||
// DataBaseName: '数据库名称',
|
||||
// SystemName: '系统名称',
|
||||
// ProjectId: '项目ID',
|
||||
// ProjectName: '项目名称',
|
||||
IoTDataType: 'IoT数据类型',
|
||||
DeviceType: '设备类型',
|
||||
DeviceAddress: '设备ID',
|
||||
DeviceId: '设备ID',
|
||||
Timestamps: '时间戳',
|
||||
// 可以根据需要添加更多映射
|
||||
};
|
||||
@ -34,10 +34,10 @@ export const fieldTypeConfig: FieldTypeConfig = {
|
||||
|
||||
// 固定字段列表 - 这些字段已经在固定列中定义,不需要在动态列中重复生成
|
||||
const FIXED_FIELDS = [
|
||||
// 'DataBaseName',
|
||||
// 'SystemName',
|
||||
'DeviceType',
|
||||
'IoTDataType',
|
||||
'DeviceAddress',
|
||||
'DeviceId',
|
||||
'Timestamps',
|
||||
'FormattedTimestamps',
|
||||
'DeviceAddress',
|
||||
|
||||
@ -8,8 +8,7 @@ import { useRoute } from 'vue-router';
|
||||
import { Page } from '@vben/common-ui';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { postDeviceInfoPage } from '#/api-client';
|
||||
import { postTreeModelDeviceDataInfoPage } from '#/api-client';
|
||||
import { postMetersPage, postTreeModelDeviceDataInfoPage } from '#/api-client';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { generateDynamicColumns } from './dynamicColumns';
|
||||
@ -27,7 +26,7 @@ const selectedDeviceInfo = ref<any>(null);
|
||||
// 获取设备信息的完整数据(用于根据设备ID获取设备信息)
|
||||
const fetchDeviceOptions = async () => {
|
||||
try {
|
||||
const { data } = await postDeviceInfoPage({
|
||||
const { data } = await postMetersPage({
|
||||
body: {
|
||||
pageIndex: 1,
|
||||
pageSize: 1000,
|
||||
@ -68,7 +67,7 @@ const formatDate = (date: Date | string) => {
|
||||
};
|
||||
|
||||
const route = useRoute();
|
||||
const { DeviceType, DeviceId, FocusAddress, DataBaseName } = route.query;
|
||||
const { DeviceType, DeviceId, FocusAddress, SystemName } = route.query;
|
||||
|
||||
// 动态列定义
|
||||
const dynamicColumns = ref<any[]>([]);
|
||||
@ -91,8 +90,8 @@ const fixedColumns = [
|
||||
slots: {},
|
||||
},
|
||||
{
|
||||
field: 'DataBaseName',
|
||||
title: $t('abp.IoTDBBase.DataBaseName'),
|
||||
field: 'SystemName',
|
||||
title: $t('abp.IoTDBBase.SystemName'),
|
||||
minWidth: 150,
|
||||
showOverflow: true,
|
||||
slots: {},
|
||||
@ -111,6 +110,13 @@ const fixedColumns = [
|
||||
showOverflow: true,
|
||||
slots: {},
|
||||
},
|
||||
{
|
||||
field: 'DeviceId',
|
||||
title: $t('abp.IoTDBBase.DeviceId'),
|
||||
minWidth: 150,
|
||||
showOverflow: true,
|
||||
slots: {},
|
||||
},
|
||||
{
|
||||
field: 'DeviceAddress',
|
||||
title: $t('abp.IoTDBBase.DeviceAddress'),
|
||||
@ -163,7 +169,7 @@ const formOptions: VbenFormProps = {
|
||||
FocusAddress: FocusAddress as string,
|
||||
DeviceType: DeviceType ? Number(DeviceType) : undefined,
|
||||
DeviceId: DeviceId as string,
|
||||
DataBaseName: DataBaseName as string,
|
||||
SystemName: SystemName as string,
|
||||
},
|
||||
// 禁用表单值变化时自动提交,使用自定义处理函数
|
||||
submitOnChange: false,
|
||||
@ -177,7 +183,7 @@ const formOptions: VbenFormProps = {
|
||||
'FocusAddress',
|
||||
'IoTDataType',
|
||||
'StartCreationTime',
|
||||
'DataBaseName',
|
||||
'SystemName',
|
||||
]);
|
||||
const hasRelevantChange = changedFields.some((field) =>
|
||||
relevantFields.has(field),
|
||||
@ -329,7 +335,7 @@ const gridOptions: VxeGridProps<any> = {
|
||||
DeviceId: finalDeviceId ? finalDeviceId.toString() : '',
|
||||
FocusAddress: finalFocusAddress || FocusAddress || '',
|
||||
// 添加其他表单参数
|
||||
DataBaseName: currentFormValues.DataBaseName || DataBaseName,
|
||||
SystemName: currentFormValues.SystemName || SystemName,
|
||||
IoTDataType: ioTDataTypeValue || undefined,
|
||||
// 添加日期范围参数
|
||||
StartCreationTime: startCreationTime || undefined,
|
||||
@ -436,7 +442,7 @@ const initializeGrid = async () => {
|
||||
}
|
||||
|
||||
// 如果有路由参数,自动触发查询
|
||||
if (DeviceType || DeviceId || FocusAddress || DataBaseName) {
|
||||
if (DeviceType || DeviceId || FocusAddress || SystemName) {
|
||||
// 延迟一下确保表格已完全初始化
|
||||
setTimeout(() => {
|
||||
if (gridApi) {
|
||||
@ -451,7 +457,7 @@ const initializeGrid = async () => {
|
||||
|
||||
// 监听路由参数变化,当有路由参数时自动触发查询
|
||||
watch(
|
||||
() => [DeviceType, DeviceId, FocusAddress, DataBaseName],
|
||||
() => [DeviceType, DeviceId, FocusAddress, SystemName],
|
||||
async (newValues, oldValues) => {
|
||||
// 如果有路由参数,等待设备信息加载完成后自动触发查询
|
||||
if (newValues.some(Boolean) && gridApi && isGridInitialized.value) {
|
||||
|
||||
@ -2,19 +2,19 @@ import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { computed } from 'vue';
|
||||
|
||||
import { getCommonGetSelectList } from '#/api-client';
|
||||
import { getSelectResultList } from '#/api-client';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
export const querySchema = computed(() => [
|
||||
{
|
||||
component: 'ApiSelect',
|
||||
fieldName: 'DataBaseName',
|
||||
label: $t('abp.IoTDBBase.DataBaseName'),
|
||||
fieldName: 'SystemName',
|
||||
label: $t('abp.IoTDBBase.SystemName'),
|
||||
componentProps: {
|
||||
api: getCommonGetSelectList,
|
||||
api: getSelectResultList,
|
||||
params: {
|
||||
query: {
|
||||
typeName: 'BusinessSystemEnum',
|
||||
TypeName: 'BusinessSystemEnum',
|
||||
},
|
||||
},
|
||||
labelField: 'secondValue',
|
||||
@ -44,10 +44,10 @@ export const querySchema = computed(() => [
|
||||
fieldName: 'DeviceType',
|
||||
label: $t('abp.IoTDBBase.DeviceType'),
|
||||
componentProps: {
|
||||
api: getCommonGetSelectList,
|
||||
api: getSelectResultList,
|
||||
params: {
|
||||
query: {
|
||||
typeName: 'MeterTypeEnum'
|
||||
TypeName: 'MeterTypeEnum',
|
||||
},
|
||||
},
|
||||
labelField: 'value',
|
||||
@ -77,10 +77,10 @@ export const querySchema = computed(() => [
|
||||
fieldName: 'IoTDataType',
|
||||
label: $t('abp.IoTDBBase.IoTDataType'),
|
||||
componentProps: {
|
||||
api: getCommonGetSelectList,
|
||||
api: getSelectResultList,
|
||||
params: {
|
||||
query: {
|
||||
typeName: 'IoTDBDataTypeConst'
|
||||
TypeName: 'IoTDBDataTypeConst',
|
||||
},
|
||||
},
|
||||
labelField: 'value',
|
||||
@ -147,8 +147,13 @@ export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'DataBaseName',
|
||||
title: $t('abp.IoTDBBase.DataBaseName'),
|
||||
field: 'SystemName',
|
||||
title: $t('abp.IoTDBBase.SystemName'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'ProjectId',
|
||||
title: $t('abp.IoTDBBase.ProjectId'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
@ -162,8 +167,8 @@ export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'DeviceAddress',
|
||||
title: $t('abp.IoTDBBase.DeviceAddress'),
|
||||
field: 'DeviceId',
|
||||
title: $t('abp.IoTDBBase.DeviceId'),
|
||||
minWidth: '150',
|
||||
},
|
||||
]);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// 基础设备数据类型
|
||||
export interface BaseDeviceData {
|
||||
DataBaseName?: string;
|
||||
SystemName?: string;
|
||||
ProjectId?: string;
|
||||
ProjectName?: string;
|
||||
IoTDataType?: string;
|
||||
|
||||
@ -8,8 +8,7 @@ import { useRoute } from 'vue-router';
|
||||
import { Page } from '@vben/common-ui';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { postDeviceInfoPage } from '#/api-client';
|
||||
import { postOneNETLogInfoPage } from '#/api-client';
|
||||
import { postMetersPage, postOneNETLogInfoPage } from '#/api-client';
|
||||
|
||||
import DeviceSelect from '../deviceData/DeviceSelect.vue';
|
||||
import { querySchema, tableSchema } from './schema';
|
||||
@ -33,7 +32,7 @@ const deviceOptions = ref<any[]>();
|
||||
// 获取设备信息的完整数据
|
||||
const fetchDeviceOptions = async () => {
|
||||
try {
|
||||
const { data } = await postDeviceInfoPage({
|
||||
const { data } = await postMetersPage({
|
||||
body: {
|
||||
pageIndex: 1,
|
||||
pageSize: 1000,
|
||||
@ -139,7 +138,7 @@ const formOptions: VbenFormProps = {
|
||||
'EndCreationTime',
|
||||
'IoTDataType',
|
||||
'StartCreationTime',
|
||||
'DataBaseName',
|
||||
'SystemName',
|
||||
]);
|
||||
const hasRelevantChange = changedFields.some((field) =>
|
||||
relevantFields.has(field),
|
||||
@ -182,7 +181,7 @@ const gridOptions: VxeGridProps<any> = {
|
||||
|
||||
// 获取选中的设备信息
|
||||
let deviceId = currentFormValues.DeviceId || '';
|
||||
let dataBaseName = '';
|
||||
let systemName = '';
|
||||
const deviceType = currentFormValues.DeviceType || '';
|
||||
|
||||
// 优先使用选中的设备信息
|
||||
@ -193,7 +192,7 @@ const gridOptions: VxeGridProps<any> = {
|
||||
: null);
|
||||
|
||||
if (deviceInfo) {
|
||||
dataBaseName = deviceInfo.businessSystemName || '';
|
||||
systemName = deviceInfo.businessSystemName || '';
|
||||
// 根据设备类型获取正确的 id
|
||||
if (Number(deviceType) === 10) {
|
||||
// 集中器类型使用 focusId
|
||||
@ -212,7 +211,7 @@ const gridOptions: VxeGridProps<any> = {
|
||||
DeviceType: deviceType,
|
||||
IoTDataType: currentFormValues.IoTDataType || '',
|
||||
DeviceId: deviceId,
|
||||
DataBaseName: dataBaseName || currentFormValues.DataBaseName || '',
|
||||
SystemName: systemName || currentFormValues.SystemName || '',
|
||||
StartCreationTime: formatDate(currentFormValues.StartCreationTime),
|
||||
EndCreationTime: formatDate(currentFormValues.EndCreationTime),
|
||||
};
|
||||
|
||||
@ -4,19 +4,19 @@ import { computed } from 'vue';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { getCommonGetSelectList } from '#/api-client';
|
||||
import { getSelectResultList } from '#/api-client';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
export const querySchema = computed(() => [
|
||||
{
|
||||
component: 'ApiSelect',
|
||||
fieldName: 'DataBaseName',
|
||||
label: $t('abp.IoTDBBase.DataBaseName'),
|
||||
fieldName: 'SystemName',
|
||||
label: $t('abp.IoTDBBase.SystemName'),
|
||||
componentProps: {
|
||||
api: getCommonGetSelectList,
|
||||
api: getSelectResultList,
|
||||
params: {
|
||||
query: {
|
||||
typeName: 'BusinessSystemEnum',
|
||||
TypeName: 'BusinessSystemEnum',
|
||||
},
|
||||
},
|
||||
labelField: 'secondValue',
|
||||
@ -46,10 +46,10 @@ export const querySchema = computed(() => [
|
||||
fieldName: 'DeviceType',
|
||||
label: $t('abp.IoTDBBase.DeviceType'),
|
||||
componentProps: {
|
||||
api: getCommonGetSelectList,
|
||||
api: getSelectResultList,
|
||||
params: {
|
||||
query: {
|
||||
typeName: 'MeterTypeEnum',
|
||||
TypeName: 'MeterTypeEnum',
|
||||
},
|
||||
},
|
||||
labelField: 'value',
|
||||
@ -79,10 +79,10 @@ export const querySchema = computed(() => [
|
||||
fieldName: 'IoTDataType',
|
||||
label: $t('abp.IoTDBBase.IoTDataType'),
|
||||
componentProps: {
|
||||
api: getCommonGetSelectList,
|
||||
api: getSelectResultList,
|
||||
params: {
|
||||
query: {
|
||||
typeName: 'IoTDBDataTypeConst',
|
||||
TypeName: 'IoTDBDataTypeConst',
|
||||
},
|
||||
},
|
||||
labelField: 'value',
|
||||
|
||||
@ -62,28 +62,40 @@ const [Grid] = useVbenVxeGrid({ formOptions, gridOptions });
|
||||
{{ row.deviceType }}
|
||||
</template>
|
||||
<template #ismanualOrNot="{ row }">
|
||||
<component :is="h(Tag, { color: row.manualOrNot ? 'green' : 'red' }, () =>
|
||||
row.manualOrNot ? $t('common.yes') : $t('common.no'),
|
||||
)
|
||||
" />
|
||||
<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'),
|
||||
)
|
||||
" />
|
||||
<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'),
|
||||
)
|
||||
" />
|
||||
<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'),
|
||||
)
|
||||
" />
|
||||
<component
|
||||
:is="
|
||||
h(Tag, { color: row.isReceived ? 'green' : 'red' }, () =>
|
||||
row.isReceived ? $t('common.yes') : $t('common.no'),
|
||||
)
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
|
||||
@ -19,7 +19,7 @@ export const querySchema = computed(() => [
|
||||
|
||||
export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
||||
{ title: $t('common.seq'), type: 'seq', width: 50 },
|
||||
{ field: 'dataBaseName', title: $t('abp.log.dataBaseName'), minWidth: '150' },
|
||||
{ field: 'systemName', title: $t('abp.log.systemName'), minWidth: '150' },
|
||||
{
|
||||
field: 'projectId',
|
||||
title: $t('abp.log.projectId'),
|
||||
|
||||
@ -12,10 +12,10 @@ import { message as Message } from 'ant-design-vue';
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
postOneNetAccountDeleteAsync,
|
||||
postOneNetAccountListAsync,
|
||||
postOneNetAccountInsertAsync,
|
||||
postOneNetAccountModifyAsync,
|
||||
postOneNETAccountDelete,
|
||||
postOneNETAccountInfoPage,
|
||||
postOneNETAccountInsert,
|
||||
postOneNETAccountModify,
|
||||
} from '#/api-client';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
import { $t } from '#/locales';
|
||||
@ -53,7 +53,7 @@ const gridOptions: VxeGridProps<any> = {
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
const { data } = await postOneNetAccountListAsync({
|
||||
const { data } = await postOneNETAccountInfoPage({
|
||||
body: {
|
||||
pageIndex: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
@ -117,21 +117,21 @@ const [EditForm, editFormApi] = useVbenForm({
|
||||
async function submit() {
|
||||
const isEdit = !!editRow.value.id;
|
||||
const formApi = isEdit ? editFormApi : addFormApi;
|
||||
const api = isEdit ? postOneNetAccountModifyAsync : postOneNetAccountInsertAsync;
|
||||
const api = isEdit ? postOneNETAccountModify : postOneNETAccountInsert;
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) return;
|
||||
|
||||
const formValues = await formApi.getValues();
|
||||
const fetchParams: any = isEdit
|
||||
? {
|
||||
id: editRow.value.id,
|
||||
...formValues,
|
||||
password: formValues.password || '000000',
|
||||
}
|
||||
id: editRow.value.id,
|
||||
...formValues,
|
||||
password: formValues.password || '000000',
|
||||
}
|
||||
: {
|
||||
...formValues,
|
||||
password: formValues.password || '000000',
|
||||
};
|
||||
...formValues,
|
||||
password: formValues.password || '000000',
|
||||
};
|
||||
|
||||
try {
|
||||
userModalApi.setState({ loading: true, confirmLoading: true });
|
||||
@ -172,7 +172,7 @@ async function onDel(record: any) {
|
||||
}
|
||||
|
||||
try {
|
||||
const resp = await postOneNetAccountDeleteAsync({ body: { id: record.id } });
|
||||
const resp = await postOneNETAccountDelete({ body: { id: record.id } });
|
||||
if (resp.data) {
|
||||
Message.success($t('common.deleteSuccess'));
|
||||
gridApi.reload();
|
||||
@ -189,31 +189,27 @@ async function onDel(record: any) {
|
||||
<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'],
|
||||
},
|
||||
]"
|
||||
/>
|
||||
<TableAction :actions="[
|
||||
{
|
||||
label: $t('common.add'),
|
||||
type: 'primary',
|
||||
icon: 'ant-design:plus-outlined',
|
||||
onClick: openAddModal.bind(null),
|
||||
auth: ['AbpIdentity.Users.Create'],
|
||||
},
|
||||
]" />
|
||||
</template>
|
||||
|
||||
<template #action="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('common.edit'),
|
||||
type: 'link',
|
||||
size: 'small',
|
||||
auth: ['AbpIdentity.Users.Update'],
|
||||
onClick: onEdit.bind(null, row),
|
||||
},
|
||||
]"
|
||||
:drop-down-actions="[
|
||||
<TableAction :actions="[
|
||||
{
|
||||
label: $t('common.edit'),
|
||||
type: 'link',
|
||||
size: 'small',
|
||||
auth: ['AbpIdentity.Users.Update'],
|
||||
onClick: onEdit.bind(null, row),
|
||||
},
|
||||
]" :drop-down-actions="[
|
||||
{
|
||||
label: $t('common.delete'),
|
||||
icon: 'ant-design:delete-outlined',
|
||||
@ -228,14 +224,10 @@ async function onDel(record: any) {
|
||||
confirm: onDel.bind(null, row),
|
||||
},
|
||||
},
|
||||
]"
|
||||
/>
|
||||
]" />
|
||||
</template>
|
||||
</Grid>
|
||||
<UserModal
|
||||
:title="editRow.id ? $t('common.edit') : $t('common.add')"
|
||||
class="w-[800px]"
|
||||
>
|
||||
<UserModal :title="editRow.id ? $t('common.edit') : $t('common.add')" class="w-[800px]">
|
||||
<component :is="editRow.id ? EditForm : AddForm" />
|
||||
</UserModal>
|
||||
</Page>
|
||||
|
||||
@ -12,10 +12,10 @@ import { message as Message, Modal, Tag } from 'ant-design-vue';
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
postOneNetProductInsertAsync,
|
||||
postOneNetProductDeleteAsync,
|
||||
postOneNetProductListAsync,
|
||||
postOneNetProductModifyAsync,
|
||||
postMetersCreate,
|
||||
postMetersDelete,
|
||||
postMetersPage,
|
||||
postMetersUpdate,
|
||||
} from '#/api-client';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
import { $t } from '#/locales';
|
||||
@ -55,7 +55,7 @@ const gridOptions: VxeGridProps<any> = {
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
const { data } = await postOneNetProductListAsync({
|
||||
const { data } = await postMetersPage({
|
||||
body: {
|
||||
pageIndex: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
@ -119,7 +119,7 @@ const [EditForm, editFormApi] = useVbenForm({
|
||||
async function submit() {
|
||||
const isEdit = !!editRow.value.id;
|
||||
const formApi = isEdit ? editFormApi : addFormApi;
|
||||
const api = isEdit ? postOneNetProductModifyAsync : postOneNetProductInsertAsync;
|
||||
const api = isEdit ? postMetersUpdate : postMetersCreate;
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) return;
|
||||
|
||||
@ -164,7 +164,7 @@ function onDel(row: any) {
|
||||
Modal.confirm({
|
||||
title: `${$t('common.confirmDelete')}${row.meterName} ?`,
|
||||
onOk: async () => {
|
||||
const result = await postOneNetProductDeleteAsync({ body: { id: row.id } });
|
||||
const result = await postMetersDelete({ body: { id: row.id } });
|
||||
if (result) {
|
||||
gridApi.reload();
|
||||
Message.success($t('common.deleteSuccess'));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user