From d91c23a3dc8cb22c0a5b2bbb5a74c6aac37469b5 Mon Sep 17 00:00:00 2001
From: xuxy <1059738716@qq.com>
Date: 星期三, 03 七月 2024 11:35:02 +0800
Subject: [PATCH] update 分类过滤

---
 uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue b/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue
index f448352..e0aa39f 100644
--- a/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue
+++ b/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,13 +38,13 @@
 					<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"
@@ -112,6 +113,10 @@
 				type: Boolean,
 				default: false
 			},
+			filter: {
+				type: Boolean,
+				default: false
+			},
 			clearIcon: {
 				type: Boolean,
 				default: true
@@ -161,8 +166,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 +194,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 +205,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 +218,7 @@
 						this.errorMessage = err;
 					})
 				}
+				//  console.log('load over')
 			},
 			show() {
 				this.isOpened = true

--
Gitblit v1.9.3