fix: workflow change status
This commit is contained in:
parent
06a6bae2ca
commit
e2d2f526e8
1 changed files with 16 additions and 12 deletions
|
|
@ -113,26 +113,30 @@ async function deleteWorkflow(id?: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function changeStatus(id?: string) {
|
async function changeStatus(id?: string, regisBId?: string) {
|
||||||
const targetId = id || currWorkflowData.value?.id;
|
const targetId = id || currWorkflowData.value?.id;
|
||||||
if (targetId === undefined) return;
|
if (targetId === undefined) return;
|
||||||
|
|
||||||
formDataWorkflow.value.status !== 'INACTIVE' ? 'INACTIVE' : 'ACTIVE';
|
formDataWorkflow.value.status =
|
||||||
|
formDataWorkflow.value.status !== 'INACTIVE' ? 'INACTIVE' : 'ACTIVE';
|
||||||
|
|
||||||
const res = await workflowStore.editWorkflowTemplate({
|
const res = await workflowStore.editWorkflowTemplate({
|
||||||
id: targetId,
|
id: targetId,
|
||||||
registeredBranchId: registeredBranchId.value,
|
registeredBranchId: regisBId || registeredBranchId.value,
|
||||||
...formDataWorkflow.value,
|
...formDataWorkflow.value,
|
||||||
});
|
});
|
||||||
if (res) {
|
if (res) {
|
||||||
console.log(res);
|
formDataWorkflow.value.status = res.data.status;
|
||||||
// if(currWorkflowData.value) currWorkflowData.value.status
|
if (currWorkflowData.value) {
|
||||||
|
currWorkflowData.value.status = res.data.status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function triggerChangeStatus(id?: string, status?: string) {
|
async function triggerChangeStatus(data?: WorkflowTemplate) {
|
||||||
const targetId = id || currWorkflowData.value?.id;
|
const targetId = (data && data.id) || currWorkflowData.value?.id;
|
||||||
const targetStatus = status || currWorkflowData.value?.status;
|
const targetStatus = (data && data.status) || currWorkflowData.value?.status;
|
||||||
|
if (data) assignFormData(data);
|
||||||
if (targetId === undefined || targetStatus === undefined) return;
|
if (targetId === undefined || targetStatus === undefined) return;
|
||||||
|
|
||||||
return await new Promise((resolve, reject) => {
|
return await new Promise((resolve, reject) => {
|
||||||
|
|
@ -150,7 +154,9 @@ async function triggerChangeStatus(id?: string, status?: string) {
|
||||||
? t('dialog.message.confirmChangeStatusOff')
|
? t('dialog.message.confirmChangeStatusOff')
|
||||||
: t('dialog.message.confirmChangeStatusOn'),
|
: t('dialog.message.confirmChangeStatusOn'),
|
||||||
action: async () => {
|
action: async () => {
|
||||||
await changeStatus(targetId).then(resolve).catch(reject);
|
await changeStatus(targetId, data?.registeredBranchId)
|
||||||
|
.then(resolve)
|
||||||
|
.catch(reject);
|
||||||
},
|
},
|
||||||
cancel: () => {},
|
cancel: () => {},
|
||||||
});
|
});
|
||||||
|
|
@ -445,9 +451,7 @@ watch(() => pageState.inputSearch, fetchWorkflowList);
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
@delete="() => deleteWorkflow(props.row.id)"
|
@delete="() => deleteWorkflow(props.row.id)"
|
||||||
@change-status="
|
@change-status="() => triggerChangeStatus(props.row)"
|
||||||
() => triggerChangeStatus(props.row.id, props.row.status)
|
|
||||||
"
|
|
||||||
/>
|
/>
|
||||||
</q-td>
|
</q-td>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue