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 oldList = o.map((v: { name: string }) => v.name);
|
||||||
const index = oldList.indexOf(workName.value);
|
const index = oldList.indexOf(workName.value);
|
||||||
|
|
||||||
if (list[index] !== oldList[index]) {
|
if (list[index] !== oldList[index] && !list.includes(workName.value)) {
|
||||||
workName.value = list[index];
|
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) {
|
function confirmDeleteWork(id: string, noDialog?: boolean) {
|
||||||
if (noDialog) {
|
if (noDialog) {
|
||||||
deleteWork(id);
|
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({
|
dialog({
|
||||||
color: 'negative',
|
color: 'negative',
|
||||||
icon: 'mdi-alert',
|
icon: 'mdi-alert',
|
||||||
title: t('dialog.title.confirmDelete'),
|
title: t('dialog.title.confirmDelete'),
|
||||||
actionText: t('general.delete'),
|
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 () => {
|
action: async () => {
|
||||||
deleteWork(id);
|
deleteWork(id);
|
||||||
flowStore.rotate();
|
flowStore.rotate();
|
||||||
},
|
},
|
||||||
cancel: () => {},
|
cancel: () => {},
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerConfirmCloseWork() {
|
function triggerConfirmCloseWork() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue