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