diff --git a/src/components/app-vuero/VUser.vue b/src/components/app-vuero/VUser.vue index fb85ea1..8b3d16a 100644 --- a/src/components/app-vuero/VUser.vue +++ b/src/components/app-vuero/VUser.vue @@ -22,6 +22,7 @@ const dataUser = reactive({ // model.value = sessioinData // }) const initiator = ref(null) +const approvers = ref([]) onBeforeMount(() => { dataUser.userSession = userSession.user.data @@ -35,6 +36,15 @@ onBeforeMount(() => { } }) +// 부모에게 넘길 결재선 전체 +const apprLine = computed(() => { + return initiator.value ? [initiator.value, ...approvers.value] : [...approvers.value] +}) + +watch(apprLine, (val) => { + model.value = val +}) + const props = defineProps({ label: { @@ -46,27 +56,11 @@ const props = defineProps({ }, disabled: { type: Boolean - }, - modelValue: { - type: Object, - default: () => ({}), - }, -}) - -export interface VUserEmits { - (e: 'update:modelValue', value: any): void -} -const emits = defineEmits() -const tagsOptions = ref([]) - -const approvers = ref() - -watch(() => props.modelValue, (newVal) => { - if (newVal.length > 0) { - emits('update:modelValue', approvers) - approvers.value = [] } }) + +const tagsOptions = ref([]) + const onKeyup = async (e: any) => { const regex_jaeum = /[ㄱ-ㅎ]/g if (e.key === 'Enter') { @@ -75,6 +69,44 @@ const onKeyup = async (e: any) => { const res = await getUserList({params:{name : e.target.value}}) if (res.length > 0) { + res.forEach(u => { + if (model.value?.length > 0) { + const ignore = model.value.reduce((a: Person, b: Person) => { + return a.sabun + '|' + b.sabun + }) + + if (typeof ignore !== 'object') { + if (ignore.includes(u.sabun)) { + u['disabled'] = true + } + } else { + if (ignore.sabun.includes(u.sabun)) { + u['disabled'] = true + } + } + } + }) + // res.forEach(u => { 2명으로 제한 로직 풀기 25.05.29 + // if (model.value?.length > 0) { + // const ignore = model.value.reduce((a: Person, b: Person) => { + // console.log("aaaaa",a.sabun) + // console.log("bbbbbb",b.sabun) + // return a.sabun + '|' + b.sabun + // }) + // + // if (typeof ignore !== 'object') { + // if (ignore.includes(u.sabun)) { + // console.log("ignore 처리",u.sabun) + // u['disabled'] = true + // } + // } else { + // if (ignore.sabun.includes(u.sabun)) { + // console.log("ignore 처리222",u.sabun) + // u['disabled'] = true + // } + // } + // } + // }) tagsOptions.value = res } } catch (e) { @@ -95,19 +127,16 @@ const onKeyup = async (e: any) => {