选择联系人组件修改,分标委样式调整
This commit is contained in:
@@ -60,6 +60,12 @@ export default {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
// value的类型
|
||||
valueType: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'string'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -109,11 +115,14 @@ export default {
|
||||
const params = {
|
||||
companyId: this.selectedCompany.id
|
||||
}
|
||||
getContactsByCompany(params).then(res => {
|
||||
this.contactsList = res.result
|
||||
if (this.initContacts && this.initContacts.hasOwnProperty.call(this.initContacts, 'id')) {
|
||||
this.contactsList.push(this.initContacts)
|
||||
}
|
||||
return new Promise(resolve => {
|
||||
getContactsByCompany(params).then(res => {
|
||||
this.contactsList = res.result
|
||||
if (this.initContacts && this.initContacts.hasOwnProperty.call(this.initContacts, 'id')) {
|
||||
this.contactsList.push(this.initContacts)
|
||||
}
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
@@ -130,9 +139,18 @@ export default {
|
||||
this.$message.warn('请先选择来款企业再为该企业新建联系人')
|
||||
},
|
||||
addContactsOk(id) {
|
||||
this.getContactsList()
|
||||
this.$emit('change', id)
|
||||
this.$emit('ok')
|
||||
this.getContactsList().then(() => {
|
||||
if (this.valueType === 'object') {
|
||||
let objContact = this.contactsList.filter(tt => tt.id === id)
|
||||
objContact = objContact[0]
|
||||
objContact.label = objContact.name
|
||||
objContact.key = objContact.id
|
||||
this.$emit('change', objContact)
|
||||
} else {
|
||||
this.$emit('change', id)
|
||||
}
|
||||
this.$emit('ok')
|
||||
})
|
||||
},
|
||||
// 下拉框的搜索
|
||||
filterOption(input, option) {
|
||||
|
||||
Reference in New Issue
Block a user