Assign button change
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
dad2711311
commit
632049c13b
|
@ -10,6 +10,7 @@ import { useValidator } from 'src/composables/useValidator';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import SkeletonForm from 'components/ui/SkeletonForm.vue';
|
import SkeletonForm from 'components/ui/SkeletonForm.vue';
|
||||||
import VnConfirm from './ui/VnConfirm.vue';
|
import VnConfirm from './ui/VnConfirm.vue';
|
||||||
|
import { tMobile } from 'src/composables/tMobile';
|
||||||
|
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const state = useState();
|
const state = useState();
|
||||||
|
@ -43,6 +44,10 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
defaultButtons: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {},
|
||||||
|
},
|
||||||
autoLoad: {
|
autoLoad: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
|
@ -119,7 +124,19 @@ const hasChanges = ref(!$props.observeFormChanges);
|
||||||
const originalData = ref({ ...$props.formInitialData });
|
const originalData = ref({ ...$props.formInitialData });
|
||||||
const formData = computed(() => state.get($props.model));
|
const formData = computed(() => state.get($props.model));
|
||||||
const formUrl = computed(() => $props.url);
|
const formUrl = computed(() => $props.url);
|
||||||
|
const defaultButtons = computed(() => ({
|
||||||
|
save: {
|
||||||
|
color: 'primary',
|
||||||
|
icon: 'restart_alt',
|
||||||
|
label: 'globals.save',
|
||||||
|
},
|
||||||
|
reset: {
|
||||||
|
color: 'primary',
|
||||||
|
icon: 'save',
|
||||||
|
label: 'globals.reset',
|
||||||
|
},
|
||||||
|
...$props.defaultButtons,
|
||||||
|
}));
|
||||||
const startFormWatcher = () => {
|
const startFormWatcher = () => {
|
||||||
watch(
|
watch(
|
||||||
() => formData.value,
|
() => formData.value,
|
||||||
|
@ -131,10 +148,6 @@ const startFormWatcher = () => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function tMobile(...args) {
|
|
||||||
if (!quasar.platform.is.mobile) return t(...args);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function fetch() {
|
async function fetch() {
|
||||||
const { data } = await axios.get($props.url, {
|
const { data } = await axios.get($props.url, {
|
||||||
params: { filter: JSON.stringify($props.filter) },
|
params: { filter: JSON.stringify($props.filter) },
|
||||||
|
@ -233,21 +246,21 @@ watch(formUrl, async () => {
|
||||||
<QBtnGroup push class="q-gutter-x-sm">
|
<QBtnGroup push class="q-gutter-x-sm">
|
||||||
<slot name="moreActions" />
|
<slot name="moreActions" />
|
||||||
<QBtn
|
<QBtn
|
||||||
:label="tMobile('globals.reset')"
|
:label="tMobile(defaultButtons.reset.label)"
|
||||||
color="primary"
|
:color="defaultButtons.reset.color"
|
||||||
icon="restart_alt"
|
:icon="defaultButtons.reset.icon"
|
||||||
flat
|
flat
|
||||||
@click="reset"
|
@click="reset"
|
||||||
:disable="!hasChanges"
|
:disable="!hasChanges"
|
||||||
:title="t('globals.reset')"
|
:title="t(defaultButtons.reset.label)"
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
:label="tMobile('globals.save')"
|
:label="tMobile(defaultButtons.save.label)"
|
||||||
color="primary"
|
:color="defaultButtons.save.color"
|
||||||
icon="save"
|
:icon="defaultButtons.save.icon"
|
||||||
@click="save"
|
@click="save"
|
||||||
:disable="!hasChanges"
|
:disable="!hasChanges"
|
||||||
:title="t('globals.save')"
|
:title="t(defaultButtons.save.label)"
|
||||||
/>
|
/>
|
||||||
</QBtnGroup>
|
</QBtnGroup>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -31,6 +31,7 @@ export default {
|
||||||
close: 'Close',
|
close: 'Close',
|
||||||
cancel: 'Cancel',
|
cancel: 'Cancel',
|
||||||
confirm: 'Confirm',
|
confirm: 'Confirm',
|
||||||
|
assign: 'Assign',
|
||||||
back: 'Back',
|
back: 'Back',
|
||||||
yes: 'Yes',
|
yes: 'Yes',
|
||||||
no: 'No',
|
no: 'No',
|
||||||
|
|
|
@ -31,6 +31,7 @@ export default {
|
||||||
close: 'Cerrar',
|
close: 'Cerrar',
|
||||||
cancel: 'Cancelar',
|
cancel: 'Cancelar',
|
||||||
confirm: 'Confirmar',
|
confirm: 'Confirmar',
|
||||||
|
assign: 'Asignar',
|
||||||
back: 'Volver',
|
back: 'Volver',
|
||||||
yes: 'Si',
|
yes: 'Si',
|
||||||
no: 'No',
|
no: 'No',
|
||||||
|
@ -881,6 +882,7 @@ export default {
|
||||||
model: 'Modelo',
|
model: 'Modelo',
|
||||||
serialNumber: 'Número de serie',
|
serialNumber: 'Número de serie',
|
||||||
removePDA: 'Desasignar PDA',
|
removePDA: 'Desasignar PDA',
|
||||||
|
assignPDA: 'Asignar PDA',
|
||||||
},
|
},
|
||||||
create: {
|
create: {
|
||||||
name: 'Nombre',
|
name: 'Nombre',
|
||||||
|
|
|
@ -2,11 +2,9 @@
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { onMounted, ref, computed } from 'vue';
|
import { onMounted, ref, computed } from 'vue';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import FormModel from 'components/FormModel.vue';
|
import FormModel from 'components/FormModel.vue';
|
||||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||||
|
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useRole } from 'src/composables/useRole';
|
import { useRole } from 'src/composables/useRole';
|
||||||
|
@ -77,7 +75,9 @@ onMounted(async () => await fetchCurrentDeviceRef.value.fetch());
|
||||||
:url-create="`Workers/${route.params.id}/allocatePDA`"
|
:url-create="`Workers/${route.params.id}/allocatePDA`"
|
||||||
model="DeviceProductionUser"
|
model="DeviceProductionUser"
|
||||||
:form-initial-data="newPDA"
|
:form-initial-data="newPDA"
|
||||||
|
:default-actions="true"
|
||||||
auto-load
|
auto-load
|
||||||
|
:default-buttons="{ save: { label: 'globals.assign', color: 'primary' } }"
|
||||||
@on-data-saved="(_, data) => setCurrentPDA(data)"
|
@on-data-saved="(_, data) => setCurrentPDA(data)"
|
||||||
>
|
>
|
||||||
<template #form="{ data }">
|
<template #form="{ data }">
|
||||||
|
|
Loading…
Reference in New Issue