feat: refs #8304 added remove option to operator
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
1142797114
commit
628ed69bdb
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed, watch } from 'vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
@ -19,6 +19,7 @@ const trainsData = ref([]);
|
||||||
const machinesData = ref([]);
|
const machinesData = ref([]);
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const routeId = computed(() => route.params.id);
|
const routeId = computed(() => route.params.id);
|
||||||
|
const selected = ref([]);
|
||||||
|
|
||||||
const initialData = computed(() => {
|
const initialData = computed(() => {
|
||||||
return {
|
return {
|
||||||
|
@ -41,6 +42,21 @@ async function insert() {
|
||||||
await axios.post('Operators', initialData.value);
|
await axios.post('Operators', initialData.value);
|
||||||
crudModelRef.value.reload();
|
crudModelRef.value.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => crudModelRef.value?.formData,
|
||||||
|
(formData) => {
|
||||||
|
if (formData && formData.length) {
|
||||||
|
if (JSON.stringify(selected.value) !== JSON.stringify(formData)) {
|
||||||
|
selected.value = formData;
|
||||||
|
}
|
||||||
|
} else if (selected.value.length > 0) {
|
||||||
|
selected.value = [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true, deep: true }
|
||||||
|
);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -67,6 +83,7 @@ async function insert() {
|
||||||
:data-required="{ workerFk: route.params.id }"
|
:data-required="{ workerFk: route.params.id }"
|
||||||
ref="crudModelRef"
|
ref="crudModelRef"
|
||||||
search-url="operator"
|
search-url="operator"
|
||||||
|
:selected="selected"
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows }">
|
||||||
|
|
Loading…
Reference in New Issue