方剂搜索

This commit is contained in:
yanwenlong
2023-12-19 22:26:17 +08:00
parent 6e08e1db2d
commit dd655db39d

View File

@@ -6,12 +6,19 @@
<!-- <uni-search-bar @confirm="search" :focus="true" v-model="searchValue" @blur="blur" @focus="focus" @input="input"
@cancel="cancel" @clear="clear">
</uni-search-bar> -->
<view class="contentBox">
<!-- <scroll-view class="scroll-view_H oneCateList" scroll-x="true" scroll-left="0"> -->
<view class="oneCateList flexbox">
<text :class="[curOneCateIndex == index ? 'cur' : '']" @click="setOneCateIndex(item,index)"
v-for="(item, index) in oneCateList" :key="item.prescriptCategoryId">{{item.title}}</text>
</view>
<view class="search_box" v-if="oneCateList.length > 0">
<!-- <u-search :disabled="userMes.pointPower == 0 && oneCateList[curOneCateIndex].id == 3 || userMes
.pointPower == 0 && oneCateList[curOneCateIndex].id == 6 ? true : false" @click="checkDisable" placeholder="请输入方剂名" @focus="focus" @clear="clear"
v-model="searchValue" @input="input" @blur="blur" @search="search"></u-search> -->
<u-search @click="checkDisable" placeholder="请输入方剂名" @focus="focus" @clear="clear"
v-model="searchValue" @input="input" @blur="blur" @search="search"></u-search>
v-model="searchValue" @input="input" @blur="blur" @search="search" @custom="search"></u-search>
</view>
<view class="searchList" v-show="showSearchList">
<view class="itemBox" v-if="searchList.length > 0">
@@ -23,13 +30,8 @@
<u-divider text="未找到相关方剂哦~"></u-divider>
</view>
</view>
<view v-show="!showSearchList" class="contentBox">
<!-- <scroll-view class="scroll-view_H oneCateList" scroll-x="true" scroll-left="0"> -->
<view class="oneCateList flexbox">
<text :class="[curOneCateIndex == index ? 'cur' : '']" @click="setOneCateIndex(item,index)"
v-for="(item, index) in oneCateList" :key="item.prescriptCategoryId">{{item.title}}</text>
</view>
<!-- </scroll-view> -->
<view v-show="!showSearchList">
<view class="grid twoCateList" v-if="twoCateList.length > 0">
<u-grid :col="3" border class="u-grid-list">
<u-grid-item v-for="(item, index) in twoCateList" :key="item.prescriptCategoryId"
@@ -58,6 +60,7 @@
<u-divider v-else text="暂无方剂数据哦~"></u-divider>
</view>
</view>
</view>
<!-- <view class="search_box flexbox" @click="">
@@ -212,6 +215,9 @@
let id = item.prescriptCategoryId
this.curOneCateIndex = index
this.curTwoCateIndex = 0
this.searchValue = ''
this.searchList = []
this.showSearchList = false
if(index!=2){
this.getTowCateList(id)
} else {
@@ -313,19 +319,23 @@
},
getSearch() {
$http.request({
url: "book/point/searchPointList",
url: "book/prescript/searchPrescript",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
loadAnimate: 'none', // 请求加载动画
'keywords': this.searchValue
'keywords': this.searchValue,
type: this.curOneCateIndex + 1
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
console.log(res, '搜索结果')
if (res.code == 0 && res.points.length > 0) {
this.searchList = res.points
if (res.code == 0 && res.list.length >= 0) {
this.showSearchList = true
this.searchList = res.list
}else{
this.searchList = []
}
}).catch(e => {
// this.titleList = []
@@ -339,6 +349,12 @@
// title: '搜索:' + res,
// icon: 'none'
// })
if (res == '') {
this.showSearchList = false
this.searchList = []
} else {
this.getSearch()
}
},
input(res) {
@@ -350,6 +366,7 @@
}
},
clear(res) {
console.log('----clear:', res)
// uni.showToast({
// title: 'clear事件清除值为',
// icon: 'none'
@@ -358,20 +375,22 @@
this.showSearchList = false
},
blur(res) {
if (res == '') {
this.showSearchList = false
this.searchList = []
} else {
this.getSearch()
}
// console.log('----blur:', res)
// if (res == '') {
// this.showSearchList = false
// this.searchList = []
// } else {
// this.getSearch()
// }
},
focus(e) {
console.log('----focus:')
// uni.showToast({
// title: 'focus事件输出值为' + e.value,
// icon: 'none'
// })
// 等于1 就是有权限
this.showSearchList = true
// this.showSearchList = true
},
// cancel(res) {
@@ -471,11 +490,10 @@
.search_box {
margin: 0 auto;
overflow: hidden;
margin-top: 20rpx;
align-items: center;
width: calc(100% - 10px);
margin-top: 0;
margin-bottom: 40rpx;
margin-top: 20rpx;
margin-bottom: 20rpx;
.search {
height: 56upx;