数通智联化工云平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.5 KiB

2 years ago
<!--
@ 作者: 秦东
@ 时间: 2023-07-20 13:49:22
@ 备注:
-->
<script lang='ts' setup>
import { computed, onMounted, nextTick } from 'vue'
2 years ago
import { criteriaForPeopleList } from '@/api/hr/org/type'
2 years ago
const props = withDefaults(
defineProps<{
modelValue?: string
disabled?: boolean
}>(),
{}
)
const emits = defineEmits<{
(e: 'update:modelValue', value: string): void
}>()
const userDialogEl = ref()
// const value:any = computed({
// get() {
// return props.modelValue
// },
// set(newVal: string) {
// emits('update:modelValue', newVal)
// }
// })
2 years ago
const userlist = ref("")
2 years ago
const value = computed({
get: () => props.modelValue,
set: (newVal: any) => {
2 years ago
// console.log("value-set",newVal)
2 years ago
emits('update:modelValue', newVal)
2 years ago
let newValJson:criteriaForPeopleList[] = JSON.parse(newVal)
// console.log("value-newValJson",newValJson)
if(newValJson.length > 0){
let userAry = new Array
newValJson.forEach(item =>{
userAry.push(item.name+"("+item.number+")")
})
userlist.value = userAry.join(',')
}
2 years ago
},
});
const openDialog = () => {
userDialogEl.value.open()
}
onMounted(() => {
nextTick(() => {})
})
2 years ago
2 years ago
</script>
<template>
<el-input
placeholder="请选择用户或输入用户名称"
v-bind="$props"
2 years ago
v-model="userlist"
2 years ago
@click="openDialog"
>
<template #append>
<i class="icon-user" @click.stop="openDialog"></i>
</template>
</el-input>
<user-dialog ref="userDialogEl" v-model="value" />
</template>
<style lang='scss' scoped>
</style>