perf: refs #8194 select worker component
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jon Elias 2024-12-05 14:19:58 +01:00
parent 96920dd540
commit fea161d5c2
1 changed files with 5 additions and 12 deletions

View File

@ -1,5 +1,5 @@
<script setup>
import { computed } from 'vue';
import { computed, useAttrs } from 'vue';
import VnSelect from 'components/common/VnSelect.vue';
import VnAvatar from 'src/components/ui/VnAvatar.vue';
@ -17,16 +17,10 @@ const $props = defineProps({
type: [String, Number, Object],
default: null,
},
params: {
type: Object,
default: null,
},
noOne: {
type: Boolean,
default: false,
},
});
const $attrs = useAttrs();
const value = computed({
get() {
return $props.modelValue;
@ -35,9 +29,10 @@ const value = computed({
emit('update:modelValue', val);
},
});
const url = computed(() => {
let url = 'Workers/search';
const { departmentCodes } = $props.params ?? {};
const { departmentCodes } = $attrs.params ?? {};
if (!departmentCodes) return url;
const params = new URLSearchParams({
departmentCodes: JSON.stringify(departmentCodes),
@ -57,8 +52,6 @@ const url = computed(() => {
option-label="nickname"
:fields="['id', 'name', 'nickname', 'code']"
sort-by="nickname ASC"
:params="$props.params"
:no-one="$props.noOne"
>
<template #prepend v-if="$props.hasAvatar">
<VnAvatar :worker-id="value" color="primary" :title="title" />