|
|
@@ -50,24 +50,39 @@ const SegregationPointForm = forwardRef<SegregationPointFormRef, SegregationPoin
|
|
|
if (id) {
|
|
|
setFormLoading(true);
|
|
|
try {
|
|
|
+ console.log('SegregationPointForm: 开始获取隔离点详情, id =', id);
|
|
|
const response = await segregationPointApi.selectIsIsolationPointById(id);
|
|
|
- const data = response?.data || response;
|
|
|
- form.setFieldsValue({
|
|
|
- pointId: data.pointId,
|
|
|
- pointName: data.pointName,
|
|
|
- pointIcon: data.pointIcon,
|
|
|
- pointPicture: data.pointPicture,
|
|
|
- pointNfc: data.pointNfc,
|
|
|
+ console.log('SegregationPointForm: 接口响应', response);
|
|
|
+
|
|
|
+ // 处理响应数据格式
|
|
|
+ const data = (response as any)?.data || response;
|
|
|
+ console.log('SegregationPointForm: 处理后的数据', data);
|
|
|
+
|
|
|
+ // 设置表单值
|
|
|
+ const formValues = {
|
|
|
+ pointId: data.pointId || data.id,
|
|
|
+ pointName: data.pointName || '',
|
|
|
+ pointIcon: data.pointIcon || '',
|
|
|
+ pointPicture: data.pointPicture || '',
|
|
|
+ pointNfc: data.pointNfc || '',
|
|
|
workstationId: data.workstationId,
|
|
|
lotoId: data.lotoId,
|
|
|
- powerType: data.powerType,
|
|
|
- pointSerialNumber: data.pointSerialNumber,
|
|
|
- remark: data.remark,
|
|
|
- });
|
|
|
+ powerType: data.powerType || '',
|
|
|
+ pointSerialNumber: data.pointSerialNumber || '',
|
|
|
+ remark: data.remark || '',
|
|
|
+ };
|
|
|
+
|
|
|
+ console.log('SegregationPointForm: 设置表单值', formValues);
|
|
|
+
|
|
|
+ // 使用 setTimeout 确保表单已渲染
|
|
|
+ setTimeout(() => {
|
|
|
+ form.setFieldsValue(formValues);
|
|
|
+ }, 0);
|
|
|
|
|
|
// 获取隔离点图标
|
|
|
await loadIsolationIcons(data.pointIcon);
|
|
|
} catch (error: any) {
|
|
|
+ console.error('SegregationPointForm: 获取隔离点详情失败', error);
|
|
|
toast.error(error.message || t('form.getSegregationPointDetailFailed'));
|
|
|
} finally {
|
|
|
setFormLoading(false);
|