From c0b24b804539df3a40a0be613b44562c7e073005 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期四, 20 四月 2023 10:43:46 +0800
Subject: [PATCH] #
---
pages/basics/matSelect.vue | 106 ++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 84 insertions(+), 22 deletions(-)
diff --git a/pages/basics/matSelect.vue b/pages/basics/matSelect.vue
index 906007d..4c919a9 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="inputF" 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,16 @@
<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>
</label>
</checkbox-group>
</scroll-view>
+ <view class="record" v-show="recordShow">
+ <label class="record-card" v-for="(item,index) in record" :key="index" @click="chose(index)">
+ <view style="padding: 0 5rpx 0 10rpx;">{{item}}</view>
+ <uni-icons style="padding: 0 5rpx 0 5rpx;" type="closeempty" size="22" color="#a5a5a5" @click="del(index)"></uni-icons>
+ </label>
+ </view>
</view>
</template>
@@ -42,13 +47,12 @@
export default {
data() {
return {
+ commonUrl:null,
condition:null,
tag: [],
data: [],
- baseHttp:'http://',
- baseIP:'',
- basePORT:'',
- baseUrl:'/lywms'
+ record: [],
+ recordShow: false,
}
},
onLoad() {
@@ -57,10 +61,10 @@
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)
+ that.record = uni.getStorageSync("record")
})
},
methods: {
@@ -71,17 +75,25 @@
this.condition = null
uni.vibrateShort();
},
+ // 鑱氱劍
+ inputF() {
+ if (this.record.length == 0) {
+ return
+ }
+ this.recordShow = true
+ },
search(condition) {
let that = this
that.tag = null
that.data = null
+ that.recordShow = false
uni.vibrateShort();
uni.showLoading({
title: '鎼滅储涓�...'
});
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
},
@@ -90,10 +102,12 @@
'token':uni.getStorageSync('token'),
},
success(result) {
+ console.log(result);
uni.hideLoading();
var res = result.data
if (res.code === 200 ) {
that.data = res.data
+ that.save()
} else if (res.code == 403) {
uni.showToast({title: res.msg, icon: "none", position: 'top'})
setTimeout(() => {
@@ -107,11 +121,36 @@
}
});
},
+ // 淇濆瓨
+ save() {
+ if (this.record === '') {
+ this.record = []
+ }
+ this.record.push(this.condition)
+ for (var i = 0; i < this.record.length; i++) {
+ for (var j = i + 1;j < this.record.length; j++) {
+ if (this.record[i] ===this.record[j]){
+ this.record.splice(j,1);
+ j--;
+ }
+ }
+ }
+
+ uni.setStorageSync("record",this.record)
+ },
+ // 鍒犻櫎
+ del(i) {
+ this.record.splice(i,1)
+ uni.setStorageSync("record",this.record)
+ },
+ chose(i) {
+ this.condition = this.record[i]
+ },
showTag(parentId) {
let that = this
uni.showLoading();
uni.request({
- 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'),
},
@@ -123,6 +162,7 @@
'token':uni.getStorageSync('token'),
},
success(result) {
+ uni.hideLoading();
that.tag = null
that.data = null
var res = result.data
@@ -142,19 +182,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
},
@@ -163,13 +202,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
}
@@ -183,7 +222,7 @@
} else {
uni.showToast({title: res.msg, icon: "none",position: 'top'})
}
-
+
}
});
},
@@ -200,6 +239,29 @@
</script>
<style>
+ .record {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ z-index: 1;
+ position: fixed;
+ top: 188rpx;
+ /* #ifdef APP-PLUS */
+ top: 89rpx;
+ /* #endif */
+ width: 100%;
+ min-height: 50rpx;
+ background-color: #E4E7ED;
+ }
+ .record-card {
+ display: flex;
+ align-items: center;
+ min-width: 100rpx;
+ height: 60rpx;
+ background-color: #C0C4CC;
+ margin: 10rpx 10rpx 10rpx 10rpx;
+ border-radius: 10rpx;
+ }
.matnr {
margin-left: 60rpx;
margin-top: 20rpx;
@@ -284,7 +346,7 @@
}
.demo-list {
border-bottom: 1px solid #d8d8d8;
- height: 180rpx;
+ height: 150rpx;
margin: 15rpx;
border-radius: 20rpx;
}
@@ -302,14 +364,14 @@
float: left;
text-align: center;
width: 100rpx;
- height: 180rpx;
- line-height: 180rpx;
+ height: 120rpx;
+ line-height: 120rpx;
}
.demo-list-right {
display: inline-block;
float: left;
width: 100%;
- height: 180rpx;
+ height: 150rpx;
color: #828282;
}
.order-ditel {
--
Gitblit v1.9.1