|
@@ -92,12 +92,8 @@ const SalaryManagement: React.FC = () => {
|
|
|
const res = await salaryClientManager.get().create.$post({ json: data });
|
|
const res = await salaryClientManager.get().create.$post({ json: data });
|
|
|
if (res.status !== 200) {
|
|
if (res.status !== 200) {
|
|
|
// 尝试从响应中提取错误信息
|
|
// 尝试从响应中提取错误信息
|
|
|
- try {
|
|
|
|
|
const errorData = await res.json();
|
|
const errorData = await res.json();
|
|
|
throw new Error(errorData.message || '创建薪资失败');
|
|
throw new Error(errorData.message || '创建薪资失败');
|
|
|
- } catch {
|
|
|
|
|
- throw new Error('创建薪资失败');
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
return await res.json();
|
|
return await res.json();
|
|
|
},
|
|
},
|
|
@@ -122,12 +118,8 @@ const SalaryManagement: React.FC = () => {
|
|
|
});
|
|
});
|
|
|
if (res.status !== 200) {
|
|
if (res.status !== 200) {
|
|
|
// 尝试从响应中提取错误信息
|
|
// 尝试从响应中提取错误信息
|
|
|
- try {
|
|
|
|
|
- const errorData = await res.json();
|
|
|
|
|
- throw new Error(errorData.message || '更新薪资失败');
|
|
|
|
|
- } catch {
|
|
|
|
|
- throw new Error('更新薪资失败');
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const errorData = await res.json();
|
|
|
|
|
+ throw new Error(errorData.message || '更新薪资失败');
|
|
|
}
|
|
}
|
|
|
return await res.json();
|
|
return await res.json();
|
|
|
},
|
|
},
|
|
@@ -147,12 +139,8 @@ const SalaryManagement: React.FC = () => {
|
|
|
const res = await salaryClientManager.get().delete[':id']['$delete']({ param: { id } });
|
|
const res = await salaryClientManager.get().delete[':id']['$delete']({ param: { id } });
|
|
|
if (res.status !== 200) {
|
|
if (res.status !== 200) {
|
|
|
// 尝试从响应中提取错误信息
|
|
// 尝试从响应中提取错误信息
|
|
|
- try {
|
|
|
|
|
- const errorData = await res.json();
|
|
|
|
|
- throw new Error(errorData.message || '删除薪资失败');
|
|
|
|
|
- } catch {
|
|
|
|
|
- throw new Error('删除薪资失败');
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const errorData = await res.json();
|
|
|
|
|
+ throw new Error(errorData.message || '删除薪资失败');
|
|
|
}
|
|
}
|
|
|
return await res.json();
|
|
return await res.json();
|
|
|
},
|
|
},
|
|
@@ -238,16 +226,22 @@ const SalaryManagement: React.FC = () => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// 处理区域选择变化
|
|
// 处理区域选择变化
|
|
|
- const handleAreaChange = (value: { provinceId?: number; cityId?: number; districtId?: number }) => {
|
|
|
|
|
- setAreaValue(value);
|
|
|
|
|
- searchForm.setValue('provinceId', value.provinceId);
|
|
|
|
|
- searchForm.setValue('cityId', value.cityId);
|
|
|
|
|
- searchForm.setValue('districtId', value.districtId);
|
|
|
|
|
|
|
+ const handleAreaChange = (value: { provinceId?: number | string; cityId?: number | string; districtId?: number | string }) => {
|
|
|
|
|
+ // 将字符串转换为数字
|
|
|
|
|
+ const provinceId = value.provinceId ? Number(value.provinceId) : undefined;
|
|
|
|
|
+ const cityId = value.cityId ? Number(value.cityId) : undefined;
|
|
|
|
|
+ const districtId = value.districtId ? Number(value.districtId) : undefined;
|
|
|
|
|
+
|
|
|
|
|
+ const numericValue = { provinceId, cityId, districtId };
|
|
|
|
|
+ setAreaValue(numericValue);
|
|
|
|
|
+ searchForm.setValue('provinceId', provinceId);
|
|
|
|
|
+ searchForm.setValue('cityId', cityId);
|
|
|
|
|
+ searchForm.setValue('districtId', districtId);
|
|
|
|
|
|
|
|
if (isCreateForm) {
|
|
if (isCreateForm) {
|
|
|
- createForm.setValue('provinceId', value.provinceId!);
|
|
|
|
|
- createForm.setValue('cityId', value.cityId!);
|
|
|
|
|
- createForm.setValue('districtId', value.districtId);
|
|
|
|
|
|
|
+ createForm.setValue('provinceId', provinceId!);
|
|
|
|
|
+ createForm.setValue('cityId', cityId!);
|
|
|
|
|
+ createForm.setValue('districtId', districtId);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|