feat: refs #8304 added remove option to operator #1195
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { ref, reactive } from 'vue';
|
||||
import { ref, reactive, useAttrs } from 'vue';
|
||||
import { onBeforeRouteLeave } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
@ -18,6 +18,8 @@ import VnInput from 'components/common/VnInput.vue';
|
|||
|
||||
const emit = defineEmits(['onFetch']);
|
||||
|
||||
|
||||
const $attrs = useAttrs();
|
||||
|
||||
const $props = defineProps({
|
||||
url: { type: String, default: null },
|
||||
saveUrl: {type: String, default: null},
|
||||
|
@ -26,7 +28,6 @@ const $props = defineProps({
|
|||
addNote: { type: Boolean, default: false },
|
||||
selectType: { type: Boolean, default: false },
|
||||
jtubau marked this conversation as resolved
Outdated
jsegarra
commented
Porque prop y no un attr? Porque prop y no un attr?
|
||||
justInput: { type: Boolean, default: false },
|
||||
required: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
|
@ -64,7 +65,7 @@ function confirmAndUpdate() {
|
|||
message: t('Are you sure remove this note?'),
|
||||
},
|
||||
})
|
||||
jtubau marked this conversation as resolved
Outdated
jsegarra
commented
.onOk(update) .onOk(update)
|
||||
.onOk(() => update())
|
||||
.onOk(update)
|
||||
.onCancel(() => {
|
||||
newNote.text = originalText;
|
||||
});
|
||||
|
@ -82,7 +83,7 @@ async function update() {
|
|||
}
|
||||
|
||||
onBeforeRouteLeave((to, from, next) => {
|
||||
jtubau marked this conversation as resolved
Outdated
jsegarra
commented
ufff...en el limite ufff...en el limite
jtubau
commented
que seria sacar la evaluación a una const y pasar la const como condición? algo asi? que seria sacar la evaluación a una const y pasar la const como condición?
const changesOnNote = (newNote.text && !$props.justInput) || (newNote.text !== originalText) && $props.justInput;
if (changesOnNote)
algo asi?
|
||||
if ((newNote.text && !$props.justInput) || (newNote.text !== originalText) && $props.justInput )
|
||||
if ((newNote.text && !$props.justInput) || (newNote.text !== originalText) && $props.justInput)
|
||||
quasar.dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
|
@ -93,6 +94,13 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
});
|
||||
else next();
|
||||
});
|
||||
|
||||
function fetchData([ data ]) {
|
||||
newNote.text = data?.notes;
|
||||
originalText = data?.notes;
|
||||
emit('onFetch', data);
|
||||
}
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
jtubau marked this conversation as resolved
Outdated
jsegarra
commented
Si usamos selectType para vincularlo con un VnSelect, porque si lo relacionamos con VnInput no hacemos inputType? Si usamos selectType para vincularlo con un VnSelect, porque si lo relacionamos con VnInput no hacemos inputType?
|
||||
|
@ -106,13 +114,13 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
v-if="justInput"
|
||||
:url="url"
|
||||
jtubau marked this conversation as resolved
Outdated
jsegarra
commented
podemos simplificar con :class="{condicion: "clase CSS"} podemos simplificar con :class="{condicion: "clase CSS"}
|
||||
:filter="filter"
|
||||
@on-fetch="(data) => (newNote.text = data[0]?.notes, originalText = data[0]?.notes, emit('onFetch', data))"
|
||||
@on-fetch="fetchData"
|
||||
auto-load
|
||||
/>
|
||||
<QCard
|
||||
class="q-pa-xs q-mb-lg full-width"
|
||||
:class="{ 'just-input': $props.justInput }"
|
||||
v-if="$props.addNote || $props.justInput"
|
||||
:style="$props.justInput ? 'padding-right: 18px; margin-bottom: 2px; box-shadow: none;' : ''"
|
||||
>
|
||||
<QCardSection horizontal v-if="!$props.justInput">
|
||||
{{ t('New note') }}
|
||||
|
@ -126,7 +134,7 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
v-model="newNote.observationTypeFk"
|
||||
option-label="description"
|
||||
style="flex: 0.15"
|
||||
:required="$props.required"
|
||||
:required="$attrs.required"
|
||||
@keyup.enter.stop="insert"
|
||||
/>
|
||||
<VnInput
|
||||
|
@ -137,7 +145,7 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
size="lg"
|
||||
autogrow
|
||||
@keyup.enter.stop="handleClick"
|
||||
:required="$props.required"
|
||||
:required="$attrs.required"
|
||||
clearable
|
||||
>
|
||||
<template #append>
|
||||
|
@ -250,6 +258,11 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
}
|
||||
}
|
||||
}
|
||||
.just-input {
|
||||
padding-right: 18px;
|
||||
margin-bottom: 2px;
|
||||
box-shadow: none;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
|
|
|
@ -26,9 +26,7 @@ onMounted(() => {
|
|||
if (data.value) observer.observe(data.value, opts);
|
||||
});
|
||||
|
||||
const actionsChildCount = () => {
|
||||
return !!actions.value?.childNodes?.length;
|
||||
};
|
||||
const actionsChildCount = computed(() => !!actions.value?.childNodes?.length);
|
||||
|
||||
onBeforeUnmount(() => stateStore.toggleSubToolbar() && hasSubToolbar);
|
||||
</script>
|
||||
jtubau marked this conversation as resolved
Outdated
jsegarra
commented
no hace falta definir llaves y return no hace falta definir llaves y return
|
||||
|
|
|
@ -23,6 +23,6 @@ const noteFilter = computed(() => {
|
|||
:body="{ clientFk: route.params.id }"
|
||||
style="overflow-y: auto"
|
||||
:select-type="true"
|
||||
:required="true"
|
||||
required
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -205,7 +205,6 @@ watch([year, businessFk], () => refreshData());
|
|||
}
|
||||
"
|
||||
:body="body"
|
||||
:required="false"
|
||||
/>
|
||||
</Teleport>
|
||||
<QPage class="column items-center">
|
||||
|
|
|
@ -221,7 +221,7 @@ const yearList = ref(generateYears());
|
|||
>
|
||||
{{ type.name }}
|
||||
</WorkerEventLabel>
|
||||
</QItem>
|
||||
</QItem>
|
||||
</QList>
|
||||
<QSeparator />
|
||||
<QList dense class="list q-my-md no-pointer-events">
|
||||
|
|
Loading…
Reference in New Issue
Tengo dudas de este componente porque le hemos metido la lógica de cuando es input, y tenemos que jugar con 2 condiciones
Mi propuesta es definir un componente tipo VnObservation que se comporte como cuando dices que es just-input=true, VnNoteType para el Vnelect y VnNote que tenga solo la lógica del textarea
Pero creo que son demasiados cambios para esta PR
Conclusión: VnNotes depende de 3 condiciones para renderizar que elemento u otro. Desacoplar la lógica
Yo lo dejaria en 2. Un VnNoteInput y un VnNote.
Donde el VnNoteInput seria el textArea.
Y el VnNote tener la logica, y este dividido en 2 partes.
Arriba un slot que por defecto contenga el VnNoteInput
Y abajo el VnPaginate
Por tanto, lo dejamos así y creamos tarea con los comentarios que hemos puesto
Importante: referenciar la PR y ambos comentarios en la descripción de la tarea. Indicando: que la funcionalidad que fusionemos en esta PR debe quedar en el mismo estado. Añadir estos como checklist