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;
|
||||
if (targetId === undefined) return;
|
||||
|
||||
formDataWorkflow.value.status !== 'INACTIVE' ? 'INACTIVE' : 'ACTIVE';
|
||||
formDataWorkflow.value.status =
|
||||
formDataWorkflow.value.status !== 'INACTIVE' ? 'INACTIVE' : 'ACTIVE';
|
||||
|
||||
const res = await workflowStore.editWorkflowTemplate({
|
||||
id: targetId,
|
||||
registeredBranchId: registeredBranchId.value,
|
||||
registeredBranchId: regisBId || registeredBranchId.value,
|
||||
...formDataWorkflow.value,
|
||||
});
|
||||
if (res) {
|
||||
console.log(res);
|
||||
// if(currWorkflowData.value) currWorkflowData.value.status
|
||||
formDataWorkflow.value.status = res.data.status;
|
||||
if (currWorkflowData.value) {
|
||||
currWorkflowData.value.status = res.data.status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function triggerChangeStatus(id?: string, status?: string) {
|
||||
const targetId = id || currWorkflowData.value?.id;
|
||||
const targetStatus = status || currWorkflowData.value?.status;
|
||||
async function triggerChangeStatus(data?: WorkflowTemplate) {
|
||||
const targetId = (data && data.id) || currWorkflowData.value?.id;
|
||||
const targetStatus = (data && data.status) || currWorkflowData.value?.status;
|
||||
if (data) assignFormData(data);
|
||||
if (targetId === undefined || targetStatus === undefined) return;
|
||||
|
||||
return await new Promise((resolve, reject) => {
|
||||
|
|
@ -150,7 +154,9 @@ async function triggerChangeStatus(id?: string, status?: string) {
|
|||
? t('dialog.message.confirmChangeStatusOff')
|
||||
: t('dialog.message.confirmChangeStatusOn'),
|
||||
action: async () => {
|
||||
await changeStatus(targetId).then(resolve).catch(reject);
|
||||
await changeStatus(targetId, data?.registeredBranchId)
|
||||
.then(resolve)
|
||||
.catch(reject);
|
||||
},
|
||||
cancel: () => {},
|
||||
});
|
||||
|
|
@ -445,9 +451,7 @@ watch(() => pageState.inputSearch, fetchWorkflowList);
|
|||
}
|
||||
"
|
||||
@delete="() => deleteWorkflow(props.row.id)"
|
||||
@change-status="
|
||||
() => triggerChangeStatus(props.row.id, props.row.status)
|
||||
"
|
||||
@change-status="() => triggerChangeStatus(props.row)"
|
||||
/>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue