111 lines
2.1 KiB
JavaScript
111 lines
2.1 KiB
JavaScript
// pages/emergency/resourse/index/index.js
|
|
const app = getApp();
|
|
|
|
Component({
|
|
/**
|
|
* 组件的属性列表
|
|
*/
|
|
properties: {
|
|
|
|
},
|
|
|
|
/**
|
|
* 组件的初始数据
|
|
*/
|
|
data: {
|
|
condition: '',
|
|
curTab: 0,
|
|
tabs: [{
|
|
lab: '应急物资',
|
|
val: 0
|
|
}, {
|
|
lab: '应急专家',
|
|
val: 0
|
|
}, {
|
|
lab: '救援队伍',
|
|
val: 0
|
|
}],
|
|
|
|
canChange: false,
|
|
freshIng: false,
|
|
page: 1,
|
|
pageSize: 10,
|
|
list: []
|
|
},
|
|
|
|
pageLifetimes: {
|
|
show: function () {
|
|
this.getList();
|
|
},
|
|
},
|
|
|
|
/**
|
|
* 组件的方法列表
|
|
*/
|
|
methods: {
|
|
|
|
/**
|
|
* 搜索
|
|
*/
|
|
inputSearch: function (e) {
|
|
this.data.condition = e.detail.value;
|
|
this.refresh();
|
|
},
|
|
|
|
/**
|
|
* 切换筛选
|
|
*/
|
|
tabSelect: function (params) {
|
|
if (!this.data.canChange) return
|
|
this.data.canChange = false;
|
|
const index = Number.parseInt(params.currentTarget.dataset.index);
|
|
this.data.curTab = index;
|
|
this.setData(this.data)
|
|
this.refresh()
|
|
},
|
|
|
|
/**
|
|
* 刷新
|
|
* @param {*} params
|
|
*/
|
|
refresh: function (params) {
|
|
this.data.page = 1;
|
|
this.data.list = [];
|
|
this.setData(this.data)
|
|
this.getList();
|
|
},
|
|
|
|
/**
|
|
* 获取列表
|
|
*/
|
|
getList: function () {
|
|
let url = ""
|
|
const params = {
|
|
page: this.data.page,
|
|
pageSize: this.data.pageSize,
|
|
}
|
|
switch (this.data.curTab) {
|
|
case 0:
|
|
url = "/OtheWareHouse/getOtheWareHousePage"
|
|
params.houseName = this.data.condition;
|
|
break;
|
|
case 1:
|
|
url = "/Othexpert/getOthexpertPage"
|
|
params.othname = this.data.condition;
|
|
break;
|
|
case 2:
|
|
url = "/Othteam/getOthteamPage"
|
|
params.teamname = this.data.condition;
|
|
break;
|
|
}
|
|
app.axios("GET", "app", url, params, true).then(res => {
|
|
this.data.canChange = true;
|
|
if (res.code == 1) {
|
|
this.data.list = [...this.data.list, ...res.data.rows];
|
|
if (res.data.rows.length != 0) this.data.page = res.data.pageNum + 1
|
|
}
|
|
this.setData(this.data)
|
|
})
|
|
}
|
|
}
|
|
}) |