epmet 工作端 小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
3.5 KiB

import {maporg, commonDemandList, userdemandList} from "../../../../../utils/statisticsApi";
Page({
data: {
orgList: [],
orgIndex: 0,
natureIndex: 0,
natureOptions: [{
value: '1',
label: '个性需求',
}, {
value: '2',
label: '共性需求',
}],
statusIndex: 0,
statusOptions: [
{
label: '按状态',
value: ''
},
{
label: '待响应',
value: '1'
},
{
label: '已指派服务',
value: '2'
},
{
label: '已完成',
value: '3'
},
],
list: [],
total: 0,
pageNo: 1,
pageSize: 20,
listType: "1",
},
onLoad(options) {
this.getOrg()
},
setVal(e) {
this.setData({
[e.currentTarget.dataset.key]: e.detail.value
})
},
getOrg() {
maporg().then(async ({data}) => {
let parent = {value: data.id, label: data.name, level: data.level}
this.setData({
orgList: [
parent, ...data.children.map(item => {
return {
value: item.id,
label: item.name,
level: item.level
}
})
]
})
console.log(this.data.orgList, 'orgList')
this.getList()
})
},
onConfirm() {
this.setData({
list: [],
pageNo: 1,
})
this.getList()
},
getList() {
if (this.data.natureOptions[this.data.natureIndex].value === '1') {
this.getPersonalityList()
} else {
this.getCommonnessList()
}
},
getPersonalityList() {
let params = {
pageNo: this.data.pageNo,
pageSize: this.data.pageSize,
orgId: this.data.orgList[this.data.orgIndex].value,
orgLevel: this.data.orgList[this.data.orgIndex].level,
status: this.data.statusIndex >= 0 ? this.data.statusOptions[this.data.statusIndex].value : '',
}
userdemandList(params).then(res => {
this.setData({
list: this.data.list.concat(res.data.list),
total: res.data.total,
listType: "1"
})
})
},
getCommonnessList() {
let params = {
pageNo: this.data.pageNo,
pageSize: this.data.pageSize,
agencyId: this.data.orgList[this.data.orgIndex].value,
level: this.data.orgList[this.data.orgIndex].level,
status: this.data.statusIndex >= 0 ? this.data.statusOptions[this.data.statusIndex].value : '',
}
commonDemandList(params).then(res => {
this.setData({
list: this.data.list.concat(res.data.list),
total: res.data.total,
listType: "2"
})
})
},
gotopage(e) {
wx.navigateTo({
url: '/subpages/statistics/pages/demand/detail/detail?id=' + e.currentTarget.dataset.id + '&type=' + this.data.listType
})
},
scrolltolower() {
if (this.data.list.length < this.data.total) {
this.setData({
pageNo: this.data.pageNo + 1
})
this.getList()
}
}
})