Files
zkxw/web-admin/src/components/oa-approval/OaOwnerDeptSelect.vue
T

46 lines
1.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!-- FormCreate:归属部门(默认当前登录人主部门;allowModify 控制可否改选) -->
<template>
<OaDeptSelect
:model-value="modelValue"
:disabled="effectiveDisabled"
:multiple="false"
:form-create-inject="formCreateInject"
@update:model-value="onUpdate"
@change="onChange"
/>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import OaDeptSelect from '@/components/oa-approval/OaDeptSelect.vue'
import type { OaDeptValueItem } from '@/utils/oa-dept-value'
defineOptions({ name: 'ownerDept' })
const props = withDefaults(
defineProps<{
modelValue?: unknown
disabled?: boolean
/** 是否允许改选;默认 false(只读展示默认值) */
allowModify?: boolean
formCreateInject?: Record<string, unknown>
}>(),
{ allowModify: false }
)
const emit = defineEmits<{
(e: 'update:modelValue', v: OaDeptValueItem | OaDeptValueItem[] | null): void
(e: 'change', v: OaDeptValueItem | OaDeptValueItem[] | null): void
}>()
const effectiveDisabled = computed(() => !!props.disabled || !props.allowModify)
function onUpdate(v: OaDeptValueItem | OaDeptValueItem[] | null) {
emit('update:modelValue', v)
}
function onChange(v: OaDeptValueItem | OaDeptValueItem[] | null) {
emit('change', v)
}
</script>