页面上方标题组件;普通项目管理和工作组项目管理接口联调
This commit is contained in:
@@ -8,7 +8,8 @@
|
||||
v-on="$listeners"
|
||||
show-search
|
||||
option-filter-prop="children"
|
||||
:filter-option="filterOption">
|
||||
:filter-option="filterOption"
|
||||
@dropdownVisibleChange="handleDropdownOpen">
|
||||
<a-select-option v-for="item in contactsList" :key="item.id" :value="item.id">{{ item.name }}</a-select-option>
|
||||
</a-select>
|
||||
</a-col>
|
||||
@@ -40,6 +41,14 @@ export default {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
// 编辑时回显的数据, 需要id,name两个字段
|
||||
initfContacts: {
|
||||
type: Object,
|
||||
required: false,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
required: false,
|
||||
@@ -49,13 +58,12 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
contactsList: [], // 该企业下联系人列表
|
||||
isFirstOpen: true, // 编辑状态下是否为第一次打开
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// 编辑 第一次不回显的问题
|
||||
if(this.selectedCompany!== null && this.selectedCompany.hasOwnProperty('id')){
|
||||
this.getContactsList()
|
||||
}
|
||||
this.getContactsList()
|
||||
},
|
||||
watch: {
|
||||
/**
|
||||
@@ -66,6 +74,15 @@ export default {
|
||||
this.getContactsList()
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
/**
|
||||
* 编辑联系人变化
|
||||
*/
|
||||
initfContacts: {
|
||||
handler() {
|
||||
this.isFirstOpen = true
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -73,12 +90,15 @@ export default {
|
||||
* 获取联系人数据
|
||||
*/
|
||||
getContactsList() {
|
||||
if (this.selectedCompany) {
|
||||
if (this.selectedCompany && this.selectedCompany.hasOwnProperty('id')) {
|
||||
const params = {
|
||||
companyId: this.selectedCompany.id
|
||||
}
|
||||
getContactsByCompany(params).then(res => {
|
||||
this.contactsList = res.result
|
||||
if (this.initfContacts && this.initfContacts.hasOwnProperty('id')) {
|
||||
this.contactsList.push(this.initfContacts)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
@@ -99,6 +119,17 @@ export default {
|
||||
return (
|
||||
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
||||
);
|
||||
},
|
||||
handleDropdownOpen() {
|
||||
if (this.isFirstOpen && this.initfContacts && this.initfContacts.hasOwnProperty('id')) {
|
||||
this.contactsList.forEach((item, index) => {
|
||||
if (item.id === this.initfContacts.id) {
|
||||
this.$emit('change', undefined)
|
||||
this.contactsList.splice(index, 1)
|
||||
}
|
||||
})
|
||||
this.isFirstOpen = false
|
||||
}
|
||||
}
|
||||
},
|
||||
model: {
|
||||
|
||||
Reference in New Issue
Block a user