120 lines
2.4 KiB
Vue
120 lines
2.4 KiB
Vue
<template>
|
|
<div>
|
|
<div class="user-organ-wrap">
|
|
<a-input
|
|
:type="inputType"
|
|
:autoSize="true"
|
|
:rows="1"
|
|
disabled
|
|
class="user-input"
|
|
:placeholder="placeholder"
|
|
:value="checkedValue"
|
|
@click="selectClick"
|
|
:title="checkedValue"
|
|
>
|
|
</a-input>
|
|
<a-button type="primary" class="button-box" @click="selectClick" :disabled="disabled">
|
|
{{ $t('userSelect.select') }}
|
|
</a-button>
|
|
</div>
|
|
<user-select-by-contact-modal v-bind="$attrs" :nameStr="nameStr" ref="selectModal" @change="selectChange" @listChange="listChange" @nameChange="nameChange"></user-select-by-contact-modal>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import UserSelectByContactModal from './UserSelectByContactModal'
|
|
export default {
|
|
name: 'UserSelectByContact',
|
|
components: { UserSelectByContactModal },
|
|
props: {
|
|
disabled: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
placeholder: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
value: {
|
|
type: String,
|
|
default: () => {
|
|
return ''
|
|
}
|
|
},
|
|
// 名字字符串
|
|
nameStr: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
// 修改的字段名
|
|
filedName: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
// 回显输入框的类型,默认是input
|
|
inputType: {
|
|
type: String,
|
|
required: false,
|
|
default: 'text'
|
|
}
|
|
},
|
|
watch: {
|
|
nameStr: {
|
|
immediate: true,
|
|
handler (val) {
|
|
this.checkedValue = val
|
|
}
|
|
}
|
|
},
|
|
data () {
|
|
return {
|
|
checkedValue: ''
|
|
}
|
|
},
|
|
methods: {
|
|
selectClick () {
|
|
this.$refs.selectModal.open(this.value)
|
|
},
|
|
selectChange (ids) {
|
|
this.$emit('change', ids)
|
|
},
|
|
listChange (value) {
|
|
this.$emit('listChange', value)
|
|
},
|
|
nameChange (value) {
|
|
this.checkedValue = value
|
|
this.$emit('nameChange', value, this.filedName)
|
|
}
|
|
},
|
|
model: {
|
|
prop: 'value',
|
|
event: 'change'
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
.user-organ-wrap {
|
|
width: 100%;
|
|
position: relative;
|
|
display: flex;
|
|
align-items: center;
|
|
//height: 39.98px;
|
|
|
|
.user-input {
|
|
resize: none;
|
|
width: calc(100% - 70px);
|
|
}
|
|
// 因为需要加title,所以不能把鼠标事件去掉
|
|
/deep/ .ant-input-disabled {
|
|
background: #fff;
|
|
color: rgba(0, 0, 0, 0.65);
|
|
cursor: default;
|
|
}
|
|
|
|
.button-box {
|
|
margin-left: 5px;
|
|
}
|
|
}
|
|
</style>
|