فهرست منبع

用户查询组件优化(0。2)

洪海涛 4 سال پیش
والد
کامیت
6c55b99497
1فایلهای تغییر یافته به همراه22 افزوده شده و 2 حذف شده
  1. 22 2
      src/components/select/searchPeople.vue

+ 22 - 2
src/components/select/searchPeople.vue

@@ -77,6 +77,7 @@ export default {
   watch: {
     value: {
       handler(newV, oldV) {
+        // console.log({ newV, oldV })
         if (this.searchValue === newV) {
           return
         }
@@ -87,7 +88,8 @@ export default {
         }
         const type = Object.prototype.toString.call(this.searchValue)
         if (type.indexOf('Array') < 0) {
-          this.getMember(this.searchValue)
+          console.log(91)
+          this.getMember(this.searchValue, true)
         } else if (type.indexOf('Array') > 0 && this.searchValue.length > 0 && this.firstGetArr) {
           this.initMore(this.searchValue)
           this.firstGetArr = false
@@ -135,7 +137,25 @@ export default {
      * @param initMore[Boolean]    搜索时,当有原始数据存在时,必然需要去重,否则会导致人员可选数据重复[true:初始化;false:用户搜索时]
      */
     arrayNonRepeatfy(data, initMore = false) {
-      this.options = !initMore ? data.map(e => e) : Array.from(new Set([...this.options, ...data]))
+      // this.options = initMore ? data.map(e => e) : Array.from(new Set([...this.options, ...data]))
+      this.options = data.map(e => e)
+      // console.log(this.options, data, 139)
+      // const weakMap = new Map()
+      // for (const item of data) {
+      //   if (!weakMap.has(item.idap)) {
+      //     weakMap.set(item.idap, item)
+      //   }
+      // }
+      // let op = null
+      // const hash = {}
+      // const item = []
+      // initMore ? op = [...this.options, ...weakMap.values()] : op = [...weakMap.values()]
+      // op.map(t => {
+      //   if (!hash[t.deptid]) {
+      //     hash[t.deptid] = true && item.push(t)
+      //   }
+      // })
+      // this.options = item
     },
     changeSelect(e) {
       if (this.searchValue === [] || this.searchValue === '') {