720c98765f
1、删除旧费用附件 API、CRUD、模型和专用前端面板,统一改用通用附件能力。 2、调整合同费用接口为 study_id 语义,并补充合同、凭证、发票等附件类型的权限映射。 3、将合同费用新建和编辑改为抽屉流程,详情页与列表页复用同一编辑组件。 4、补充数据库迁移、附件列表、合同费用抽屉和权限场景测试,覆盖旧权限移除与新流程。
26 lines
1.0 KiB
TypeScript
26 lines
1.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { readFileSync } from "node:fs";
|
|
import { resolve } from "node:path";
|
|
|
|
const read = (relativePath: string) => readFileSync(resolve(__dirname, relativePath), "utf8");
|
|
|
|
describe("Contract fee project permissions", () => {
|
|
it("hides list create/delete controls when the matching backend operation is not allowed", () => {
|
|
const source = read("./ContractFees.vue");
|
|
|
|
expect(source).toContain('v-if="canCreate"');
|
|
expect(source).toContain('v-if="canDelete"');
|
|
expect(source).toContain("if (!canCreate.value)");
|
|
expect(source).toContain("if (!canDelete.value)");
|
|
expect(source).not.toContain(':disabled="!canCreate"');
|
|
expect(source).not.toContain(':disabled="!canDelete || isInactiveSite(scope.row.center_id)"');
|
|
});
|
|
|
|
it("hides detail edit controls and blocks direct navigation without update permission", () => {
|
|
const source = read("./ContractFeeDetail.vue");
|
|
|
|
expect(source).toContain('v-if="canWrite"');
|
|
expect(source).toContain("if (!canWrite.value)");
|
|
});
|
|
});
|