fix(04): work name => name being use (delete), re select
This commit is contained in:
parent
1dd7873fce
commit
b53ec8e91c
2 changed files with 15 additions and 4 deletions
|
|
@ -66,8 +66,9 @@ watch(
|
|||
const oldList = o.map((v: { name: string }) => v.name);
|
||||
const index = oldList.indexOf(workName.value);
|
||||
|
||||
if (list[index] !== oldList[index]) {
|
||||
workName.value = list[index];
|
||||
if (list[index] !== oldList[index] && !list.includes(workName.value)) {
|
||||
if (list.length - 1 === index - 1) workName.value = list[index - 1];
|
||||
else workName.value = list[index];
|
||||
}
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1155,19 +1155,29 @@ async function submitGroup() {
|
|||
function confirmDeleteWork(id: string, noDialog?: boolean) {
|
||||
if (noDialog) {
|
||||
deleteWork(id);
|
||||
} else
|
||||
} else {
|
||||
const currUseName =
|
||||
service.value?.map((v) => v.work.map((x) => x.name)).flat() || [];
|
||||
const deleteTarget = workNameItems.value.find(
|
||||
(v: { id: string }) => v.id === id,
|
||||
).name;
|
||||
const isNameInUse = currUseName.includes(deleteTarget);
|
||||
|
||||
dialog({
|
||||
color: 'negative',
|
||||
icon: 'mdi-alert',
|
||||
title: t('dialog.title.confirmDelete'),
|
||||
actionText: t('general.delete'),
|
||||
message: t('dialog.message.confirmDelete'),
|
||||
message: isNameInUse
|
||||
? `${t('dialog.message.beingUse', { msg: deleteTarget })} ${t('dialog.message.confirmDelete')}`
|
||||
: t('dialog.message.confirmDelete'),
|
||||
action: async () => {
|
||||
deleteWork(id);
|
||||
flowStore.rotate();
|
||||
},
|
||||
cancel: () => {},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function triggerConfirmCloseWork() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue