feat: check tab before add
This commit is contained in:
parent
2c9f7ba02d
commit
be397112f6
5 changed files with 103 additions and 62 deletions
|
|
@ -145,6 +145,23 @@ export function selectOptionFilter(
|
|||
return { options, filter };
|
||||
}
|
||||
|
||||
export function checkTabBeforeAdd(data: unknown[], except?: string[]) {
|
||||
if (!data) return;
|
||||
const lastData = data[data.length - 1];
|
||||
|
||||
if (typeof lastData !== 'object') return false;
|
||||
|
||||
let canAdd = false;
|
||||
for (const [key, val] of Object.entries(
|
||||
lastData as Record<string, unknown>,
|
||||
)) {
|
||||
if (except?.includes(key)) continue;
|
||||
canAdd = val !== '' && val !== null;
|
||||
if (canAdd) break;
|
||||
}
|
||||
return canAdd;
|
||||
}
|
||||
|
||||
const useUtilsStore = defineStore('utilsStore', () => {
|
||||
const currentTitle = ref<{
|
||||
title: string;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue