mirror of
https://git.hmsn.ink/kospo/svcm/oa.git
synced 2026-03-20 01:12:30 +09:00
com:remove: update에서만 쓰던 컴포넌트 공통 컴포넌트로 사용가능하여 제거 - 근태 selectBox
This commit is contained in:
@@ -1,84 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import {useCodes} from '/src/stores/codeStore.ts'
|
|
||||||
|
|
||||||
const detailCode = useCodes()
|
|
||||||
export interface VSelectProps {
|
|
||||||
raw?: boolean
|
|
||||||
multiple?: boolean
|
|
||||||
cd_grp?: string
|
|
||||||
placeholder?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
defineOptions({
|
|
||||||
inheritAttrs: false,
|
|
||||||
})
|
|
||||||
|
|
||||||
const modelValue = defineModel<any>({
|
|
||||||
default: '',
|
|
||||||
})
|
|
||||||
const props = defineProps<VSelectProps>()
|
|
||||||
const attrs = useAttrs()
|
|
||||||
|
|
||||||
const { field, id } = useVFieldContext({
|
|
||||||
create: false,
|
|
||||||
help: 'VSelect',
|
|
||||||
})
|
|
||||||
|
|
||||||
const internal = computed({
|
|
||||||
get() {
|
|
||||||
if (field?.value) {
|
|
||||||
return field.value.value
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return modelValue.value
|
|
||||||
}
|
|
||||||
},
|
|
||||||
set(value: any) {
|
|
||||||
if (field?.value) {
|
|
||||||
field.value.setValue(value)
|
|
||||||
}
|
|
||||||
modelValue.value = value
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const classes = computed(() => {
|
|
||||||
if (props.raw) return []
|
|
||||||
|
|
||||||
return ['select', props.multiple && 'is-multiple']
|
|
||||||
})
|
|
||||||
|
|
||||||
const cdItems = ref<Array<{ cd: string; nm: string }>>([])
|
|
||||||
|
|
||||||
watch(() => props.cd_grp, async (newVal) => {
|
|
||||||
if (newVal) {
|
|
||||||
await detailCode.setDetailCode(newVal)
|
|
||||||
cdItems.value = detailCode.getCodeList(newVal)
|
|
||||||
}
|
|
||||||
}, { immediate: true })
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div :class="classes">
|
|
||||||
<select
|
|
||||||
:id="id"
|
|
||||||
v-bind="attrs"
|
|
||||||
v-model="internal"
|
|
||||||
:name="id"
|
|
||||||
:multiple="props.multiple"
|
|
||||||
@change="field?.handleChange"
|
|
||||||
@blur="field?.handleBlur"
|
|
||||||
>
|
|
||||||
<option value="null">{{ props.placeholder || '선택하세요' }}</option>
|
|
||||||
<option value="">{{ props.placeholder || '선택하세요' }}</option>
|
|
||||||
<option
|
|
||||||
v-for="item in cdItems"
|
|
||||||
:key="item.cd"
|
|
||||||
:value="item.cd"
|
|
||||||
>
|
|
||||||
<slot name="code" :item="item">
|
|
||||||
{{ item.nm }}
|
|
||||||
</slot>
|
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
1
types/components.d.ts
vendored
1
types/components.d.ts
vendored
@@ -486,7 +486,6 @@ declare module 'vue' {
|
|||||||
VCustomButton: typeof import('./../src/components/app-vuero/VCustomButton.vue')['default']
|
VCustomButton: typeof import('./../src/components/app-vuero/VCustomButton.vue')['default']
|
||||||
VDarkmodeSwitch: typeof import('./../src/components/base/VDarkmodeSwitch.vue')['default']
|
VDarkmodeSwitch: typeof import('./../src/components/base/VDarkmodeSwitch.vue')['default']
|
||||||
VDarkmodeToggle: typeof import('./../src/components/base/VDarkmodeToggle.vue')['default']
|
VDarkmodeToggle: typeof import('./../src/components/base/VDarkmodeToggle.vue')['default']
|
||||||
VDefaultCodeSelect: typeof import('./../src/components/app-vuero/VDefaultCodeSelect.vue')['default']
|
|
||||||
VDropdown: typeof import('./../src/components/base/VDropdown.vue')['default']
|
VDropdown: typeof import('./../src/components/base/VDropdown.vue')['default']
|
||||||
VField: typeof import('./../src/components/base/VField.vue')['default']
|
VField: typeof import('./../src/components/base/VField.vue')['default']
|
||||||
VFieldAddonDirectionalDocumentation: typeof import('./../documentation/field/v-field-addon-directional-documentation.md')['default']
|
VFieldAddonDirectionalDocumentation: typeof import('./../documentation/field/v-field-addon-directional-documentation.md')['default']
|
||||||
|
|||||||
Reference in New Issue
Block a user