浏览代码

人物选择组件

wangziqian 5 年之前
父节点
当前提交
7eff632eca
共有 2 个文件被更改,包括 15 次插入7 次删除
  1. 14 4
      src/components/select/searchPeople.vue
  2. 1 3
      src/views/projectManage/requirement/requirementDetail.vue

+ 14 - 4
src/components/select/searchPeople.vue

@@ -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)

+ 1 - 3
src/views/projectManage/requirement/requirementDetail.vue

@@ -573,9 +573,7 @@ export default {
           this.form_query.referredClientType = this.form_query.referredClientTypes
         }
         this.availableStatusList = res.data.availableStatusList
-        const rqmtProposer = JSON.parse(JSON.stringify(this.form_query.rqmtProposer))
-        console.log(rqmtProposer, 'cdscc')
-        if (rqmtProposer[0] === '' || rqmtProposer === null) {
+        if (this.form_query.rqmtProposer === null || this.form_query.rqmtProposer === '') {
           this.form_query.rqmtProposer = null
         } else {
           this.form_query.rqmtProposer = this.form_query.rqmtProposer.split(',')