|
@@ -31,7 +31,7 @@ import { memberQueryMemberInfoByIDAPorName } from '@/api/projectIndex'
|
|
|
export default {
|
|
|
props: {
|
|
|
value: {
|
|
|
- type: [String, Array],
|
|
|
+ type: [String, Array, Object],
|
|
|
default: '',
|
|
|
required: false
|
|
|
},
|
|
@@ -70,11 +70,15 @@ export default {
|
|
|
if (this.searchValue === newV) {
|
|
|
return
|
|
|
}
|
|
|
- this.searchValue = newV
|
|
|
+ if (newV === null) {
|
|
|
+ this.multiple ? this.searchValue = [] : this.searchValue = ''
|
|
|
+ } else {
|
|
|
+ this.searchValue = newV
|
|
|
+ }
|
|
|
const type = Object.prototype.toString.call(this.searchValue)
|
|
|
if (type.indexOf('Array') < 0) {
|
|
|
- this.remoteMethod(newV)
|
|
|
- } else if (type.indexOf('Array') > 0 && newV.length > 0 && this.firstGetArr) {
|
|
|
+ this.remoteMethod(this.searchValue)
|
|
|
+ } else if (type.indexOf('Array') > 0 && this.searchValue.length > 0 && this.firstGetArr) {
|
|
|
this.initMore(this.searchValue)
|
|
|
this.firstGetArr = false
|
|
|
}
|
|
@@ -93,6 +97,9 @@ export default {
|
|
|
},
|
|
|
async getMember(query, initMore = false) {
|
|
|
const res = await memberQueryMemberInfoByIDAPorName({ memberIDAP: query })
|
|
|
+ if (res.data === null) {
|
|
|
+ return
|
|
|
+ }
|
|
|
this.loading = false
|
|
|
const weakMap = new Map()
|
|
|
for (const item of res.data) {
|
|
@@ -103,6 +110,9 @@ export default {
|
|
|
initMore ? this.options = [...this.options, ...weakMap.values()] : this.options = [...weakMap.values()]
|
|
|
},
|
|
|
changeSelect(e) {
|
|
|
+ if (this.searchValue === [] || this.searchValue === '') {
|
|
|
+ this.searchValue = null
|
|
|
+ }
|
|
|
this.$emit('update:value', this.searchValue)
|
|
|
if (this.multiple) {
|
|
|
this.$emit('change', this.searchValue)
|