统一项目角色展示与预设文案
This commit is contained in:
@@ -8,6 +8,15 @@ import type { ApiEndpointPermissionsResponse } from "@/types/api";
|
||||
|
||||
vi.mock("@/api/projectPermissions", () => ({
|
||||
fetchApiOperations: vi.fn().mockResolvedValue({ data: { operations: [] } }),
|
||||
fetchPermissionTemplates: vi.fn().mockResolvedValue({
|
||||
data: [
|
||||
{ category: "PM", name: "PM", description: "项目负责人,统筹项目全局,协调进度、资源与关键决策。" },
|
||||
{ category: "CRA", name: "CRA", description: "负责各中心临床监查执行,跟进现场质量、数据和问题闭环。" },
|
||||
{ category: "IMP", name: "CTA", description: "负责合同、药品及相关项目事务管理,保障执行支持与物资协同。" },
|
||||
{ category: "MEDICAL_REVIEW", name: "QA", description: "负责医学审核与稽查,关注质量风险、合规性和医学一致性。" },
|
||||
{ category: "PV", name: "PV", description: "负责药物警戒相关工作,跟踪安全性事件并支持风险评估。" },
|
||||
],
|
||||
}),
|
||||
}));
|
||||
|
||||
describe("ApiEndpointPermissions.vue", () => {
|
||||
@@ -70,6 +79,17 @@ describe("ApiEndpointPermissions.vue", () => {
|
||||
expect(source).toContain("updatedMatrix[role][operation_key] = allowed");
|
||||
});
|
||||
|
||||
it("renders role headers from template display names while keeping matrix role keys", () => {
|
||||
const source = readFileSync(resolve(__dirname, "./ApiEndpointPermissions.vue"), "utf8");
|
||||
|
||||
expect(source).toContain("useRoleTemplateMeta");
|
||||
expect(source).toContain(':label="roleLabel(role)"');
|
||||
expect(source).toContain(':key="role"');
|
||||
expect(source).toContain("isOperationAllowed(row.operation_key, role)");
|
||||
expect(source).toContain("onPermissionChange(row.operation_key, role, val)");
|
||||
expect(source).not.toContain(':label="role"');
|
||||
});
|
||||
|
||||
it("filters endpoints by search text", async () => {
|
||||
const wrapper = mount(ApiEndpointPermissions, {
|
||||
props: {
|
||||
|
||||
Reference in New Issue
Block a user