From 4ef4fea7f3e36342100d82061c40b00c45a18801 Mon Sep 17 00:00:00 2001
From: whycq <123456>
Date: 星期一, 17 十月 2022 08:49:50 +0800
Subject: [PATCH] #

---
 pages/basics/matSelect.vue |  121 ++++++++++++++++++++++++++++++++--------
 1 files changed, 97 insertions(+), 24 deletions(-)

diff --git a/pages/basics/matSelect.vue b/pages/basics/matSelect.vue
index 48f24cd..e0a9cd6 100644
--- a/pages/basics/matSelect.vue
+++ b/pages/basics/matSelect.vue
@@ -4,7 +4,7 @@
 			<view class="search-box">
 				<view class="search-area">
 					<view class="search-icon"><uni-icons type="search" size="25" color="#a5a5a5"></uni-icons></view>
-					<input type="text" v-model="condition" placeholder="璇疯緭鍏ュ晢鍝佺紪鐮� / 鍚嶇О"/>
+					<input type="text" @focus="searchFoucs" @blur="serchBlur" v-model="condition" placeholder="璇疯緭鍏ュ晢鍝佺紪鐮� / 鍚嶇О"/>
 					<view class="close-icon" @click="reset()"><uni-icons type="closeempty" size="25" color="#a5a5a5"></uni-icons></view>
 				</view>
 				<view class="search-btn"><button @click="search(condition)" class="cu-btn bg-blue">鎼滅储</button></view>
@@ -30,11 +30,23 @@
 							<view class="cu-tag bg-cyan ">鍟嗗搧</view>
 						</view>
 						<view class="matnr"><text style="width: 400rpx;">{{item.matnr}}</text></view>
-						<view class="matnr"><text style="width: 400rpx;">{{item.maktx}}</text></view>
+						<view class="matnr"><text style="width: 400rpx;">{{item.specs}}</text></view>
 					</view>
 				</label>
 			</checkbox-group>
 		</scroll-view>
+		<view v-if="reList.length > 0" >
+			<scroll-view scroll-y  class="record" v-if="recordShow">
+				<view class="record-data" v-for="(item,index) in reList" :key="index" >
+					<text style="margin-right: 10rpx;" @click="choseMatnr(item)">{{item}}</text>
+					<view style="height: 50rpx;display: inline-block;" @click="removeRecord(index)">
+						<uni-icons type="closeempty" size="15" color="#a5a5a5"></uni-icons>
+					</view>
+				</view>
+				
+				
+			</scroll-view>
+		</view>
 		</view>
 </template>
 
@@ -42,13 +54,12 @@
 	export default {
 		data() {
 			return {
+				commonUrl:null,
 				condition:null,
 				tag: [],
 				data: [],
-				baseHttp:'http://',
-				baseIP:'',
-				basePORT:'',
-				baseUrl:'/jkwms'
+				reList: [],
+				recordShow: false,
 			}
 		},
 		onLoad() {
@@ -57,13 +68,31 @@
 			const eventChannel = this.getOpenerEventChannel();
 			
 			// 鐩戝惉acceptDataFromOpenerPage浜嬩欢锛岃幏鍙栦笂涓�椤甸潰閫氳繃eventChannel浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹�
-			eventChannel.on('acceptDataFromOpenerPage', function(data) {
-				that.baseIP = data.baseIP
-				that.basePORT = data.basePORT
+			eventChannel.on('commonUrl', function(data) {
+				that.commonUrl = data.commonUrl
+				
 				that.showTag(1)
 			})
 		},
 		methods: {
+			removeRecord(index) {
+				this.reList.splice(index,1)
+				uni.setStorageSync('recordList',this.reList)
+			},
+			choseMatnr(matnr) {
+				this.condition = matnr
+			},
+			searchFoucs() {
+				var reL = uni.getStorageSync('recordList')
+				if (reL.length == 0) {
+					reL = []
+				}
+				this.reList = reL
+				this.recordShow = true
+			},
+			serchBlur() {
+				// this.recordShow = false
+			},
 			checkbox() {
 				
 			},
@@ -72,7 +101,10 @@
 				uni.vibrateShort();
 			},
 			search(condition) {
+				this.recordShow = false
 				let that = this
+				// that.reList.push(that.condition)
+				// uni.setStorageSync('recordList',that.reList)
 				that.tag = null
 				that.data = null
 				uni.vibrateShort();
@@ -81,7 +113,7 @@
 				});
 				uni.request({
 					// url: "http://localhost:8081/jkwms/tag/list/pda/auth",
-				    url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mat/search/pda/auth',
+				    url: that.commonUrl + '/mat/search/pda/auth',
 				    data: {
 						condition: condition
 				    },
@@ -94,6 +126,18 @@
 						var res = result.data
 						if (res.code === 200 ) {
 							that.data = res.data
+							if (that.reList.length == 0) {
+								that.reList.push(that.condition)
+								uni.setStorageSync('recordList',that.reList)
+								return
+							}
+							for(var i = 0;i < that.reList.length;i++) {
+								if (that.reList[i] == that.condition) {
+									that.reList.splice(i,1)
+								}
+							}
+							that.reList.unshift(that.condition)
+							uni.setStorageSync('recordList',that.reList)
 						} else if (res.code == 403) {
 							uni.showToast({title: res.msg, icon: "none", position: 'top'})
 							setTimeout(() => {
@@ -109,21 +153,21 @@
 			},
 			showTag(parentId) {
 				let that = this
-				uni.vibrateShort();
 				uni.showLoading();
 				uni.request({
-					// url: "http://localhost:8081/jkwms/tag/list/pda/auth",
-				    url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/tag/list/pda/auth',
+				    url: that.commonUrl + '/tag/list/pda/auth',
+					header: {
+						'token':uni.getStorageSync('token'),
+					},
 				    data: {
 						limit: 100000,
 						parentId: parentId
 				    },
-					method:"GET",
-				    header: {
+					header: {
 						'token':uni.getStorageSync('token'),
-				    },
+					},
 					success(result) {
-						
+						uni.hideLoading();
 						that.tag = null
 						that.data = null
 						var res = result.data
@@ -143,19 +187,18 @@
 						} else {
 							uni.showToast({title: res.msg, icon: "none",position: 'top'})
 						}
-						uni.hideLoading();
+						
 					}
 				});
 			},
 			showMat(tagId) {
-				uni.vibrateShort();
+				uni.showLoading();
 				let that = this
 				if (tagId == null || tagId == '' || tagId == undefined) {
 					return;
 				}
 				uni.request({
-					// url: "http://localhost:8081/jkwms/mat/list/pda/auth",
-				    url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mat/list/pda/auth',
+				    url: that.commonUrl + '/mat/list/pda/auth',
 				    data: {
 						tagId: tagId
 				    },
@@ -164,13 +207,13 @@
 						'token':uni.getStorageSync('token'),
 				    },
 					success(result) {
+						uni.hideLoading();
 						that.tag = null
 						var res = result.data
 						if (res.code === 200) {
 							if (res.data != null && res.data.length > 0) {
-								uni.showLoading();
 								that.data = res.data
-								uni.hideLoading();
+								
 							} else {
 								// that.tagId = parentId
 							}
@@ -184,7 +227,7 @@
 						} else {
 							uni.showToast({title: res.msg, icon: "none",position: 'top'})
 						}
-						
+			
 					}
 				});
 			},
@@ -201,6 +244,36 @@
 </script>
 
 <style>
+	.record-data {
+		height: 60rpx;
+		background-color: #FFF;
+		line-height: 60rpx;
+		padding-left: 20rpx;
+		padding-right: 20rpx;
+		margin-left: 20rpx;
+		margin-top: 10rpx;
+		display: inline-block;
+		border-radius: 20rpx;
+		text-align: center;
+	}
+	.record-data:last-child {
+		margin-bottom: 10rpx;
+	}
+	.record {
+		z-index: 11;
+		display: flex;
+		flex-direction: column;
+		flex-wrap: wrap;
+		position: absolute;
+		top:94rpx;
+		/* #ifdef APP-PLUS */
+		top: 94rpx;
+		/* #endif */
+		width: 100%;
+		min-height: 80rpx;
+		max-height: 600rpx;
+		background-color: #6f6f6f;
+	}
 	.matnr {
 		margin-left: 60rpx;
 		margin-top: 20rpx;

--
Gitblit v1.9.1