mirror of
https://github.com/hpd840321/craftlabs-authorization-sdk.git
synced 2026-06-09 10:00:30 +08:00
feat(m2): add contract change versioning with CHANGING state
This commit is contained in:
@@ -379,3 +379,11 @@ export function getCallbackStats(params) {
|
||||
export function getProjectHealth() {
|
||||
return axios.get('/api/v1/reports/project-health');
|
||||
}
|
||||
|
||||
// —— I11 合同变更版本 ——————————————————————————
|
||||
export function initiateContractChange(id, body) {
|
||||
return axios.post(`/api/v1/contracts/${id}/changes`, body);
|
||||
}
|
||||
export function completeContractChange(id) {
|
||||
return axios.post(`/api/v1/contracts/${id}/changes/complete`);
|
||||
}
|
||||
|
||||
@@ -132,6 +132,8 @@ import {
|
||||
listProjects,
|
||||
uploadContractAttachment,
|
||||
listContractAttachments,
|
||||
initiateContractChange,
|
||||
completeContractChange,
|
||||
} from "../api/platform";
|
||||
import { apiErrorMessage } from "../utils/apiErrorMessage";
|
||||
|
||||
@@ -176,6 +178,7 @@ const contractId = computed(() => route.params.id);
|
||||
|
||||
const isDraft = computed(() => String(contract.value?.status ?? "").toUpperCase() === "DRAFT");
|
||||
const isEffective = computed(() => String(contract.value?.status ?? "").toUpperCase() === "EFFECTIVE");
|
||||
const isChanging = computed(() => String(contract.value?.status ?? "").toUpperCase() === "CHANGING");
|
||||
|
||||
const lineRows = computed(() => {
|
||||
const c = contract.value;
|
||||
@@ -475,7 +478,13 @@ function onTransition(btn) {
|
||||
if (id == null) return;
|
||||
transitionLoading.value = btn.status;
|
||||
try {
|
||||
await patchContractStatus(id, { status: btn.status });
|
||||
if (btn.status === "CHANGING") {
|
||||
await initiateContractChange(id, { reason: "" });
|
||||
} else if (btn.status === "EFFECTIVE" && isChanging.value) {
|
||||
await completeContractChange(id);
|
||||
} else {
|
||||
await patchContractStatus(id, { status: btn.status });
|
||||
}
|
||||
ElMessage.success("状态已更新");
|
||||
await refreshAll();
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user