移除无用日志
This commit is contained in:
parent
0ce33054d8
commit
8b24e4219e
@ -49,27 +49,11 @@ const fetchDeviceOptions = async () => {
|
||||
|
||||
// 根据设备ID获取设备信息对象
|
||||
const getDeviceInfoById = (deviceId: string) => {
|
||||
console.log('getDeviceInfoById 调用:', { deviceId, deviceOptionsLength: deviceOptions.value?.length });
|
||||
|
||||
if (!deviceId || !deviceOptions.value || deviceOptions.value.length === 0) {
|
||||
console.log('getDeviceInfoById 返回 null - 条件不满足');
|
||||
return null;
|
||||
}
|
||||
|
||||
// 查看前几个设备的数据结构
|
||||
console.log('前3构:', deviceOptions.value.slice(0, 3).map(device => ({
|
||||
id: device.id,
|
||||
meterName: device.meterName,
|
||||
meterId: device.meterId,
|
||||
focusId: device.focusId,
|
||||
systemName: device.systemName,
|
||||
keys: Object.keys(device),
|
||||
fullDevice: JSON.parse(JSON.stringify(device)) // 展开完整对象
|
||||
})));
|
||||
|
||||
const device = deviceOptions.value.find((device) => device.id === deviceId);
|
||||
console.log('查找结果:', device);
|
||||
|
||||
return device;
|
||||
};
|
||||
|
||||
@ -88,7 +72,6 @@ const getDeviceInfoFromRef = async () => {
|
||||
typeof deviceSelectRef.value.getSelectedDevice === 'function'
|
||||
) {
|
||||
const deviceInfo = deviceSelectRef.value.getSelectedDevice();
|
||||
console.log('从 ref 获取设备信息:', deviceInfo);
|
||||
return deviceInfo;
|
||||
}
|
||||
return null;
|
||||
@ -100,15 +83,9 @@ const formOptions: VbenFormProps = {
|
||||
submitOnChange: false,
|
||||
// 添加表单值变化的处理函数
|
||||
handleValuesChange: async (values, changedFields) => {
|
||||
console.log('handleValuesChange 被触发:', { values, changedFields });
|
||||
console.log('当前所有表单值:', values);
|
||||
console.log('DeviceType:', values.DeviceType);
|
||||
console.log('IoTDataType:', values.IoTDataType);
|
||||
|
||||
// 当 DeviceId 发生变化时,更新 selectedDeviceInfo
|
||||
if (changedFields.includes('DeviceId')) {
|
||||
const deviceId = values.DeviceId;
|
||||
console.log('DeviceId 变化:', deviceId);
|
||||
|
||||
if (deviceId) {
|
||||
// 先尝试从 deviceOptions 中查找(备用方案)
|
||||
@ -123,13 +100,12 @@ const formOptions: VbenFormProps = {
|
||||
device = deviceSelectRef.getSelectedDevice();
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('获取组件实例失败:', error);
|
||||
// 静默处理错误
|
||||
}
|
||||
}
|
||||
|
||||
if (device) {
|
||||
selectedDeviceInfo.value = device;
|
||||
console.log('handleValuesChange 更新设备信息:', device);
|
||||
} else {
|
||||
// 如果还是没找到,尝试延迟获取(组件可能还没完全更新)
|
||||
setTimeout(() => {
|
||||
@ -139,11 +115,10 @@ const formOptions: VbenFormProps = {
|
||||
const delayedDevice = deviceSelectRef.getSelectedDevice();
|
||||
if (delayedDevice) {
|
||||
selectedDeviceInfo.value = delayedDevice;
|
||||
console.log('延迟获取设备信息成功:', delayedDevice);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('延迟获取组件实例失败:', error);
|
||||
// 静默处理错误
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
@ -201,24 +176,15 @@ const gridOptions: VxeGridProps<any> = {
|
||||
// 获取当前表单值,如果formValues为空则从表单API获取
|
||||
const currentFormValues = formValues || (gridApi?.formApi ? await gridApi.formApi.getValues() : {}) || {};
|
||||
|
||||
console.log('查询时的 formValues:', formValues);
|
||||
console.log('查询时的 currentFormValues:', currentFormValues);
|
||||
|
||||
// 获取选中的设备信息
|
||||
let deviceId = currentFormValues.DeviceId || '';
|
||||
let systemName = '';
|
||||
const deviceType = currentFormValues.DeviceType || '';
|
||||
|
||||
console.log('查询参数:', { deviceId, deviceType, currentFormValues });
|
||||
console.log('currentFormValues.DeviceId:', currentFormValues.DeviceId);
|
||||
console.log('currentFormValues.DeviceType:', currentFormValues.DeviceType);
|
||||
console.log('currentFormValues.IoTDataType:', currentFormValues.IoTDataType);
|
||||
|
||||
// 优先使用选中的设备信息
|
||||
const deviceInfo = selectedDeviceInfo.value || (currentFormValues.DeviceId && deviceOptions.value.length > 0 ? getDeviceInfoById(currentFormValues.DeviceId) : null);
|
||||
|
||||
if (deviceInfo) {
|
||||
console.log('使用设备信息:', deviceInfo);
|
||||
systemName = deviceInfo.systemName || '';
|
||||
// 根据设备类型获取正确的 id
|
||||
if (Number(deviceType) === 10) {
|
||||
@ -228,8 +194,6 @@ const gridOptions: VxeGridProps<any> = {
|
||||
// 其他设备类型使用 meterId
|
||||
deviceId = deviceInfo.meterId || deviceId;
|
||||
}
|
||||
} else {
|
||||
console.log('没有找到设备信息,使用原始 deviceId:', deviceId);
|
||||
}
|
||||
|
||||
// 构建查询参数
|
||||
@ -246,8 +210,6 @@ const gridOptions: VxeGridProps<any> = {
|
||||
FocusAddress: currentFormValues.FocusAddress || '',
|
||||
};
|
||||
|
||||
console.log('最终查询参数:', queryParams);
|
||||
|
||||
if (DeviceType) queryParams.DeviceType = DeviceType;
|
||||
if (DeviceId) queryParams.DeviceId = DeviceId;
|
||||
const { data } = await postCTWingLogInfoPage({
|
||||
|
||||
@ -49,27 +49,11 @@ const fetchDeviceOptions = async () => {
|
||||
|
||||
// 根据设备ID获取设备信息对象
|
||||
const getDeviceInfoById = (deviceId: string) => {
|
||||
console.log('getDeviceInfoById 调用:', { deviceId, deviceOptionsLength: deviceOptions.value?.length });
|
||||
|
||||
if (!deviceId || !deviceOptions.value || deviceOptions.value.length === 0) {
|
||||
console.log('getDeviceInfoById 返回 null - 条件不满足');
|
||||
return null;
|
||||
}
|
||||
|
||||
// 查看前几个设备的数据结构
|
||||
console.log('前3构:', deviceOptions.value.slice(0, 3).map(device => ({
|
||||
id: device.id,
|
||||
meterName: device.meterName,
|
||||
meterId: device.meterId,
|
||||
focusId: device.focusId,
|
||||
systemName: device.systemName,
|
||||
keys: Object.keys(device),
|
||||
fullDevice: JSON.parse(JSON.stringify(device)) // 展开完整对象
|
||||
})));
|
||||
|
||||
const device = deviceOptions.value.find((device) => device.id === deviceId);
|
||||
console.log('查找结果:', device);
|
||||
|
||||
return device;
|
||||
};
|
||||
|
||||
@ -87,7 +71,6 @@ const getDeviceInfoFromRef = async () => {
|
||||
typeof deviceSelectRef.value.getSelectedDevice === 'function'
|
||||
) {
|
||||
const deviceInfo = deviceSelectRef.value.getSelectedDevice();
|
||||
console.log('从 ref 获取设备信息:', deviceInfo);
|
||||
return deviceInfo;
|
||||
}
|
||||
return null;
|
||||
@ -99,15 +82,9 @@ const formOptions: VbenFormProps = {
|
||||
submitOnChange: false,
|
||||
// 添加表单值变化的处理函数
|
||||
handleValuesChange: async (values, changedFields) => {
|
||||
console.log('handleValuesChange 被触发:', { values, changedFields });
|
||||
console.log('当前所有表单值:', values);
|
||||
console.log('DeviceType:', values.DeviceType);
|
||||
console.log('IoTDataType:', values.IoTDataType);
|
||||
|
||||
// 当 DeviceId 发生变化时,更新 selectedDeviceInfo
|
||||
if (changedFields.includes('DeviceId')) {
|
||||
const deviceId = values.DeviceId;
|
||||
console.log('DeviceId 变化:', deviceId);
|
||||
|
||||
if (deviceId) {
|
||||
// 先尝试从 deviceOptions 中查找(备用方案)
|
||||
@ -122,13 +99,12 @@ const formOptions: VbenFormProps = {
|
||||
device = deviceSelectRef.getSelectedDevice();
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('获取组件实例失败:', error);
|
||||
// 静默处理错误
|
||||
}
|
||||
}
|
||||
|
||||
if (device) {
|
||||
selectedDeviceInfo.value = device;
|
||||
console.log('handleValuesChange 更新设备信息:', device);
|
||||
} else {
|
||||
// 如果还是没找到,尝试延迟获取(组件可能还没完全更新)
|
||||
setTimeout(() => {
|
||||
@ -138,11 +114,10 @@ const formOptions: VbenFormProps = {
|
||||
const delayedDevice = deviceSelectRef.getSelectedDevice();
|
||||
if (delayedDevice) {
|
||||
selectedDeviceInfo.value = delayedDevice;
|
||||
console.log('延迟获取设备信息成功:', delayedDevice);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('延迟获取组件实例失败:', error);
|
||||
// 静默处理错误
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
@ -200,24 +175,15 @@ const gridOptions: VxeGridProps<any> = {
|
||||
// 获取当前表单值,如果formValues为空则从表单API获取
|
||||
const currentFormValues = formValues || (gridApi?.formApi ? await gridApi.formApi.getValues() : {}) || {};
|
||||
|
||||
console.log('查询时的 formValues:', formValues);
|
||||
console.log('查询时的 currentFormValues:', currentFormValues);
|
||||
|
||||
// 获取选中的设备信息
|
||||
let deviceId = currentFormValues.DeviceId || '';
|
||||
let systemName = '';
|
||||
const deviceType = currentFormValues.DeviceType || '';
|
||||
|
||||
console.log('查询参数:', { deviceId, deviceType, currentFormValues });
|
||||
console.log('currentFormValues.DeviceId:', currentFormValues.DeviceId);
|
||||
console.log('currentFormValues.DeviceType:', currentFormValues.DeviceType);
|
||||
console.log('currentFormValues.IoTDataType:', currentFormValues.IoTDataType);
|
||||
|
||||
// 优先使用选中的设备信息
|
||||
const deviceInfo = selectedDeviceInfo.value || (currentFormValues.DeviceId && deviceOptions.value.length > 0 ? getDeviceInfoById(currentFormValues.DeviceId) : null);
|
||||
|
||||
if (deviceInfo) {
|
||||
console.log('使用设备信息:', deviceInfo);
|
||||
systemName = deviceInfo.systemName || '';
|
||||
// 根据设备类型获取正确的 id
|
||||
if (Number(deviceType) === 10) {
|
||||
@ -227,8 +193,6 @@ const gridOptions: VxeGridProps<any> = {
|
||||
// 其他设备类型使用 meterId
|
||||
deviceId = deviceInfo.meterId || deviceId;
|
||||
}
|
||||
} else {
|
||||
console.log('没有找到设备信息,使用原始 deviceId:', deviceId);
|
||||
}
|
||||
|
||||
// 构建查询参数
|
||||
@ -244,8 +208,6 @@ const gridOptions: VxeGridProps<any> = {
|
||||
EndCreationTime: formatDate(currentFormValues.EndCreationTime),
|
||||
};
|
||||
|
||||
console.log('最终查询参数:', queryParams);
|
||||
|
||||
if (DeviceType) queryParams.DeviceType = DeviceType;
|
||||
if (DeviceId) queryParams.DeviceId = DeviceId;
|
||||
const { data } = await postOneNETLogInfoPage({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user