Merge branch 'Wren' into shiy-login
This commit is contained in:
@@ -1171,6 +1171,7 @@ export async function getEvaluationPointGroups(
|
|||||||
name,
|
name,
|
||||||
code,
|
code,
|
||||||
is_enabled,
|
is_enabled,
|
||||||
|
pid,
|
||||||
orderBy = 'created_at',
|
orderBy = 'created_at',
|
||||||
order = 'desc'
|
order = 'desc'
|
||||||
} = params || {};
|
} = params || {};
|
||||||
@@ -1182,20 +1183,46 @@ export async function getEvaluationPointGroups(
|
|||||||
if (name) queryParams.append('name', name);
|
if (name) queryParams.append('name', name);
|
||||||
if (code) queryParams.append('code', code);
|
if (code) queryParams.append('code', code);
|
||||||
if (is_enabled !== undefined) queryParams.append('is_enabled', String(is_enabled));
|
if (is_enabled !== undefined) queryParams.append('is_enabled', String(is_enabled));
|
||||||
|
// 🔑 添加 pid 参数过滤
|
||||||
|
// pid=null 或 pid='0' 表示只查询一级分组,后端需要识别字符串 "null"
|
||||||
|
// 如果 pid 未定义,则不传该参数(默认查询所有分组)
|
||||||
|
if (pid !== undefined) {
|
||||||
|
if (pid === null || pid === '0') {
|
||||||
|
// 方案1:传递字符串 "null",后端需要识别并转换为 None/NULL
|
||||||
|
queryParams.append('pid', 'null');
|
||||||
|
// 方案2:不传参数,后端默认查询一级分组(需要后端支持)
|
||||||
|
// 不添加 pid 参数
|
||||||
|
} else {
|
||||||
|
queryParams.append('pid', String(pid));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const url = `/api/v3/evaluation-point-groups?${queryParams.toString()}`;
|
const url = `/api/v3/evaluation-point-groups?${queryParams.toString()}`;
|
||||||
|
|
||||||
const response = await apiRequest<EvaluationPointGroupListResponse>(url, {
|
const response = await apiRequest<EvaluationPointGroupListResponse>(url, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: token ? { 'Authorization': `Bearer ${token}` } : {}
|
...(token ? { headers: { 'Authorization': `Bearer ${token}` } } : {})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 🔍 调试:打印完整响应
|
||||||
|
console.log('📦 getEvaluationPointGroups 完整响应:', JSON.stringify(response, null, 2));
|
||||||
|
|
||||||
if (response.error) {
|
if (response.error) {
|
||||||
|
console.error('❌ getEvaluationPointGroups 错误:', response.error);
|
||||||
return { error: response.error, status: response.status };
|
return { error: response.error, status: response.status };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
|
console.log('📊 response.data:', response.data);
|
||||||
|
console.log('📊 response.data.data:', response.data.data);
|
||||||
|
|
||||||
|
if (!response.data.data) {
|
||||||
|
console.error('❌ response.data.data 不存在!完整 response.data:', response.data);
|
||||||
|
return { error: '返回数据格式不正确:缺少 data 字段', status: 500 };
|
||||||
|
}
|
||||||
|
|
||||||
const ruleGroups = response.data.data.map(convertApiGroupToRuleGroup);
|
const ruleGroups = response.data.data.map(convertApiGroupToRuleGroup);
|
||||||
|
console.log('✅ 转换后的 ruleGroups:', ruleGroups);
|
||||||
return {
|
return {
|
||||||
data: ruleGroups,
|
data: ruleGroups,
|
||||||
totalCount: response.data.total
|
totalCount: response.data.total
|
||||||
@@ -1233,7 +1260,7 @@ export async function getAllEvaluationPointGroups(
|
|||||||
|
|
||||||
const response = await apiRequest<EvaluationPointGroupListResponse>(url, {
|
const response = await apiRequest<EvaluationPointGroupListResponse>(url, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: token ? { 'Authorization': `Bearer ${token}` } : {}
|
...(token ? { headers: { 'Authorization': `Bearer ${token}` } } : {})
|
||||||
});
|
});
|
||||||
|
|
||||||
if (response.error) {
|
if (response.error) {
|
||||||
@@ -1275,7 +1302,7 @@ export async function getEvaluationPointGroup(
|
|||||||
|
|
||||||
const response = await apiRequest<EvaluationPointGroupResponse>(url, {
|
const response = await apiRequest<EvaluationPointGroupResponse>(url, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: token ? { 'Authorization': `Bearer ${token}` } : {}
|
...(token ? { headers: { 'Authorization': `Bearer ${token}` } } : {})
|
||||||
});
|
});
|
||||||
|
|
||||||
if (response.error) {
|
if (response.error) {
|
||||||
@@ -1325,7 +1352,7 @@ export async function getEvaluationPointGroupChildren(
|
|||||||
|
|
||||||
const response = await apiRequest<EvaluationPointGroupListResponse>(url, {
|
const response = await apiRequest<EvaluationPointGroupListResponse>(url, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: token ? { 'Authorization': `Bearer ${token}` } : {}
|
...(token ? { headers: { 'Authorization': `Bearer ${token}` } } : {})
|
||||||
});
|
});
|
||||||
|
|
||||||
if (response.error) {
|
if (response.error) {
|
||||||
@@ -1484,7 +1511,7 @@ export async function deleteEvaluationPointGroup(
|
|||||||
`/api/v3/evaluation-point-groups/${id}`,
|
`/api/v3/evaluation-point-groups/${id}`,
|
||||||
{
|
{
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
headers: token ? { 'Authorization': `Bearer ${token}` } : {}
|
...(token ? { headers: { 'Authorization': `Bearer ${token}` } } : {})
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -814,7 +814,7 @@ export default function RuleGroupsIndex() {
|
|||||||
<Table
|
<Table
|
||||||
columns={columns}
|
columns={columns}
|
||||||
dataSource={processedData}
|
dataSource={processedData}
|
||||||
rowKey="id"
|
rowKey={(record) => record.isParent ? `parent-${record.id}` : `child-${record.id}`}
|
||||||
emptyText="暂无分组数据"
|
emptyText="暂无分组数据"
|
||||||
className="tree-table"
|
className="tree-table"
|
||||||
/>
|
/>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user