|
|
@ -214,12 +214,26 @@ async function submitForm() { |
|
|
|
submitted.value = true |
|
|
|
submitted.value = true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function getPreFilledLink() { |
|
|
|
|
|
|
|
if (isLocked.value || !isUIAllowed('dataInsert')) return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const preFilledData = { ...formState, ...state.value } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log('preFilled Data', preFilledData) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const c of visibleColumns.value) { |
|
|
|
|
|
|
|
if (c.title && preFilledData[c.title] && preFilledData[c.title].trim()) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function clearForm() { |
|
|
|
async function clearForm() { |
|
|
|
if (isLocked.value || !isUIAllowed('dataInsert')) return |
|
|
|
if (isLocked.value || !isUIAllowed('dataInsert')) return |
|
|
|
|
|
|
|
|
|
|
|
formState = reactive<Record<string, any>>({}) |
|
|
|
formState = reactive<Record<string, any>>({}) |
|
|
|
state.value = {} |
|
|
|
state.value = {} |
|
|
|
await formRef.value.clearValidate() |
|
|
|
await formRef.value?.clearValidate() |
|
|
|
reloadEventHook.trigger() |
|
|
|
reloadEventHook.trigger() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -566,6 +580,7 @@ watch(submitted, (v) => { |
|
|
|
const intvl = setInterval(() => { |
|
|
|
const intvl = setInterval(() => { |
|
|
|
if (--secondsRemain.value < 0) { |
|
|
|
if (--secondsRemain.value < 0) { |
|
|
|
submitted.value = false |
|
|
|
submitted.value = false |
|
|
|
|
|
|
|
clearForm() |
|
|
|
clearInterval(intvl) |
|
|
|
clearInterval(intvl) |
|
|
|
} |
|
|
|
} |
|
|
|
}, 1000) |
|
|
|
}, 1000) |
|
|
@ -736,7 +751,16 @@ useEventListener( |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div v-if="formViewData.submit_another_form || !isPublic" class="text-right mt-4"> |
|
|
|
<div v-if="formViewData.submit_another_form || !isPublic" class="text-right mt-4"> |
|
|
|
<NcButton type="primary" size="medium" @click="submitted = false"> |
|
|
|
<NcButton |
|
|
|
|
|
|
|
type="primary" |
|
|
|
|
|
|
|
size="medium" |
|
|
|
|
|
|
|
@click=" |
|
|
|
|
|
|
|
() => { |
|
|
|
|
|
|
|
submitted = false |
|
|
|
|
|
|
|
clearForm() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
" |
|
|
|
|
|
|
|
> |
|
|
|
{{ $t('activity.submitAnotherForm') }} |
|
|
|
{{ $t('activity.submitAnotherForm') }} |
|
|
|
</NcButton> |
|
|
|
</NcButton> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -1289,18 +1313,31 @@ useEventListener( |
|
|
|
> |
|
|
|
> |
|
|
|
{{ $t('activity.clearForm') }} |
|
|
|
{{ $t('activity.clearForm') }} |
|
|
|
</NcButton> |
|
|
|
</NcButton> |
|
|
|
<NcButton |
|
|
|
<div class="flex items-center gap-3"> |
|
|
|
html-type="submit" |
|
|
|
<NcButton |
|
|
|
type="primary" |
|
|
|
type="primary" |
|
|
|
size="small" |
|
|
|
size="small" |
|
|
|
:disabled="!isUIAllowed('dataInsert') || !visibleColumns.length" |
|
|
|
:disabled="!isUIAllowed('dataInsert') || !visibleColumns.length || isLocked" |
|
|
|
class="nc-form-submit nc-form-focus-element" |
|
|
|
class="nc-form-get-pre-filled-link nc-form-focus-element" |
|
|
|
data-testid="nc-form-submit" |
|
|
|
data-testid="nc-form-get-pre-filled-link" |
|
|
|
data-title="nc-form-submit" |
|
|
|
data-title="nc-form-get-pre-filled-link" |
|
|
|
@click="submitForm" |
|
|
|
@click="getPreFilledLink" |
|
|
|
> |
|
|
|
> |
|
|
|
{{ $t('general.submit') }} |
|
|
|
{{ $t('activity.getPreFilledLink') }} |
|
|
|
</NcButton> |
|
|
|
</NcButton> |
|
|
|
|
|
|
|
<NcButton |
|
|
|
|
|
|
|
html-type="submit" |
|
|
|
|
|
|
|
type="primary" |
|
|
|
|
|
|
|
size="small" |
|
|
|
|
|
|
|
:disabled="!isUIAllowed('dataInsert') || !visibleColumns.length" |
|
|
|
|
|
|
|
class="nc-form-submit nc-form-focus-element" |
|
|
|
|
|
|
|
data-testid="nc-form-submit" |
|
|
|
|
|
|
|
data-title="nc-form-submit" |
|
|
|
|
|
|
|
@click="submitForm" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
{{ $t('general.submit') }} |
|
|
|
|
|
|
|
</NcButton> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</a-form> |
|
|
|
</a-form> |
|
|
|
|
|
|
|
|
|
|
|