|
@@ -15,7 +15,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
-import { onMounted, ref, computed } from "vue";
|
|
|
|
|
|
|
+import { onMounted, ref, computed, watch } from "vue";
|
|
|
import { userTypes } from "src/api/user";
|
|
import { userTypes } from "src/api/user";
|
|
|
import { useI18n } from "vue-i18n";
|
|
import { useI18n } from "vue-i18n";
|
|
|
import DefaultSelect from "src/components/defaults/DefaultSelect.vue";
|
|
import DefaultSelect from "src/components/defaults/DefaultSelect.vue";
|
|
@@ -30,6 +30,7 @@ const props = defineProps({
|
|
|
default: () => useI18n().t("common.ui.misc.type"),
|
|
default: () => useI18n().t("common.ui.misc.type"),
|
|
|
},
|
|
},
|
|
|
accessScope: { type: String, default: null },
|
|
accessScope: { type: String, default: null },
|
|
|
|
|
+ unitId: { type: Number, default: null },
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const { placeholder, label } = props;
|
|
const { placeholder, label } = props;
|
|
@@ -62,9 +63,10 @@ const filterFn = (val, update) => {
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-onMounted(async () => {
|
|
|
|
|
|
|
+const loadOptions = async () => {
|
|
|
|
|
+ isLoading.value = true;
|
|
|
try {
|
|
try {
|
|
|
- const response = await userTypes(props.accessScope);
|
|
|
|
|
|
|
+ const response = await userTypes(props.accessScope, props.unitId);
|
|
|
userTypeOptions.value = Object.entries(response).map(([key, value]) => ({
|
|
userTypeOptions.value = Object.entries(response).map(([key, value]) => ({
|
|
|
label: value,
|
|
label: value,
|
|
|
value: key,
|
|
value: key,
|
|
@@ -75,5 +77,9 @@ onMounted(async () => {
|
|
|
} finally {
|
|
} finally {
|
|
|
isLoading.value = false;
|
|
isLoading.value = false;
|
|
|
}
|
|
}
|
|
|
-});
|
|
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+onMounted(loadOptions);
|
|
|
|
|
+
|
|
|
|
|
+watch(() => [props.accessScope, props.unitId], loadOptions);
|
|
|
</script>
|
|
</script>
|