维修项目搜索
This commit is contained in:
parent
10588ddf4f
commit
2cc88967d4
@ -34,10 +34,14 @@
|
||||
<!-- </view>-->
|
||||
<view class="projList">
|
||||
<!-- <view v-for="(proj, index) in item.projList" :key="proj.id" class="projItem" @click="chooseProj(proj)">-->
|
||||
<view class="addProj" @click="addProject()" v-if="show">
|
||||
<view class="addProj" @click="addProject()" v-if="show && typeId!=0">
|
||||
<!-- <text class="projName">新增维修项目</text>-->
|
||||
<button type="primary" size="mini" class="addBtn" >新增</button>
|
||||
</view>
|
||||
<view class="search-box" v-if="typeId==0">
|
||||
<input type="text" placeholder="请输入项目名称" v-model="searchText" />
|
||||
<button type="primary" size="mini" class="addBtn" @click="searchProject()" >搜索</button>
|
||||
</view>
|
||||
<view v-for="item in groupList" :key="item.id" class="projItem" @click="chooseProj(item)">
|
||||
<text class="projName">{{ item.name }}</text>
|
||||
<image v-if="selectedProj && selectedProj.find(f => f.id === item.id)" class="projChooseIcon"
|
||||
@ -62,10 +66,16 @@ export default {
|
||||
selectedProj: [
|
||||
|
||||
],
|
||||
typeList: [],
|
||||
typeId: 1,
|
||||
typeList: [
|
||||
{
|
||||
id:0,
|
||||
name:"搜索",
|
||||
}
|
||||
],
|
||||
typeId: 0,
|
||||
groupList: [],
|
||||
show: false
|
||||
show: false,
|
||||
searchText:""
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
@ -121,6 +131,10 @@ export default {
|
||||
})
|
||||
},
|
||||
getProjeectList() {
|
||||
this.typeList = [{
|
||||
id:0,
|
||||
name:"搜索",
|
||||
}]
|
||||
const params = {
|
||||
pageNo: 1,
|
||||
pageSize: 100000,
|
||||
@ -132,30 +146,56 @@ export default {
|
||||
method: 'GET',
|
||||
params: params
|
||||
}).then(res => {
|
||||
this.typeList = res.data
|
||||
this.typeList = this.typeList.concat(res.data)
|
||||
})
|
||||
},
|
||||
getProject() {
|
||||
if(this.typeId!=0){
|
||||
request({
|
||||
url: '/admin-api/repair/project/page',
|
||||
method: 'GET',
|
||||
params: {
|
||||
pageNo: 1,
|
||||
pageSize: 10000,
|
||||
type: this.typeId
|
||||
}
|
||||
}).then(res => {
|
||||
this.groupList = res.data.records
|
||||
})
|
||||
}else{
|
||||
this.groupList = []
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 搜搜项目名称
|
||||
*/
|
||||
searchProject(){
|
||||
if(this.searchText==""){
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '请输入项目名称'
|
||||
})
|
||||
return
|
||||
}
|
||||
request({
|
||||
url: '/admin-api/repair/project/page',
|
||||
method: 'GET',
|
||||
params: {
|
||||
pageNo: 1,
|
||||
pageSize: 10000,
|
||||
type: this.typeId
|
||||
name: this.searchText
|
||||
}
|
||||
}).then(res => {
|
||||
this.groupList = res.data.records
|
||||
})
|
||||
},
|
||||
|
||||
confirm() {
|
||||
this.$emit('confirm', this.selectedProj)
|
||||
this.cancel()
|
||||
},
|
||||
cancel() {
|
||||
this.selectedProj = []
|
||||
this.groupList = this.typeList[0].groupList
|
||||
this.groupList = []
|
||||
this.$refs.popup.close()
|
||||
}
|
||||
}
|
||||
@ -292,8 +332,16 @@ export default {
|
||||
.addProj{
|
||||
text-align: right;
|
||||
}
|
||||
.search-box{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-bottom: 1px solid #EEEEEE;
|
||||
padding-bottom: 10rpx;
|
||||
}
|
||||
.projItem {
|
||||
display: flex;
|
||||
padding: 10rpx 0;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user