xuxueyang
2024-09-05 f8867b8df117d1ac0f1311970994e15059c3da03
uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue
@@ -3,6 +3,7 @@
      <view class="uni-data-tree-input" @click="handleInput">
         <slot :options="options" :data="inputSelected" :error="errorMessage">
            <view class="input-value" :class="{'input-value-border': border}">
               <text v-if="errorMessage" class="selected-area error-text">{{errorMessage}}</text>
               <view v-else-if="loading && !isOpened" class="selected-area">
                  <uni-load-more class="load-more" :contentText="loadMore" status="loading"></uni-load-more>
@@ -37,17 +38,18 @@
               <view class="dialog-close-plus dialog-close-rotate" data-id="close"></view>
            </view>
         </view>
         <view v-if="false"
            style="margin-left:40rpx;margin-right:40rpx;; border-bottom:1px solid #eee;padding-bottom:20rpx;display:flex">
         <view v-if="filter"
            style="margin-left:40rpx;margin-right:40rpx;; border-bottom:1px solid #eee;padding-bottom:20rpx;display:flex;color:#000">
            <input v-model="search" style="height:60rpx;line-height:60rpx;color:#000" placeholder="请输入搜索内容"></input>
            <button @click="()=>{search='';updateSearch()}"
               style="height:60rpx;line-height:60rpx;margin-left:auto;margin-right:0rpx">清空</button>
            <button @click="updateSearch"
               style="height:60rpx;line-height:60rpx;margin-left:auto;margin-right:0rpx">搜索</button>
            <view @click="()=>{search='';updateSearch()}"
               style="height:60rpx;line-height:60rpx;margin-left:auto;margin-right:0rpx">清空</view>
            <view @click="updateSearch"
               style="height:60rpx;line-height:60rpx;margin-left:auto;margin-right:0rpx">搜索</view>
         </view>
         <data-picker-view class="picker-view" ref="pickerView" v-model="dataValue" :localdata="localdata"
            :preload="preload" :collection="collection" :field="field" :orderby="orderby" :where="where"
            :key="showpicker"
            :area="area"
            :step-searh="stepSearh" :self-field="selfField" :parent-field="parentField" :managed-mode="true"
            :map="map" :ellipsis="ellipsis" @change="onchange" @datachange="ondatachange" @nodeclick="onnodeclick">
         </data-picker-view>
@@ -112,6 +114,10 @@
            type: Boolean,
            default: false
         },
         filter: {
            type: Boolean,
            default: false
         },
         clearIcon: {
            type: Boolean,
            default: true
@@ -127,6 +133,10 @@
         ellipsis: {
            type: Boolean,
            default: true
         },
         area:{
            type: Boolean,
            default: false
         }
      },
      data() {
@@ -161,8 +171,8 @@
            await this.$emit('search',this.search)
            // console.log('updateSearch',this.localdata)
            setTimeout(() => {
               console.log('updateSearch2',this.localdata)
               this.showpicker = new Date().getTime()
               console.log('updateSearch2 setTimeout',this.localdata)
               // this.showpicker = new Date().getTime()
               // this.load()
               this.$refs.pickerView.updateData({
                  treeData: this.localdata,
@@ -189,7 +199,9 @@
            this.load();
         },
         load() {
            // console.log('load',this.readonly)
            if (this.readonly) {
               // console.debug('load readonly')
               this._processReadonly(this.localdata, this.dataValue);
               return;
            }
@@ -198,7 +210,10 @@
            if (this.isLocalData) {
               this.loadData();
               this.inputSelected = this.selected.slice(0);
               console.log('load isLocalData',this.inputSelected)
            } else if (this.isCloudDataList || this.isCloudDataTree) { // 回显 Cloud 数据
               // console.log('load Cloud')
               this.loading = true;
               this.getCloudDataValue().then((res) => {
                  this.loading = false;
@@ -208,6 +223,7 @@
                  this.errorMessage = err;
               })
            }
            //  console.log('load over')
         },
         show() {
            this.isOpened = true