var req_url = getApp().globalData.base_url;
|
const app = getApp()
|
Page({
|
data: {
|
buttonColor: 0,
|
// list: [], //会员列表
|
total: 0, //分页总数
|
page: 1, //分页记录数
|
pagesize: 10, //分页大小
|
isLoading: false,
|
onRefresh: true,
|
value: '',
|
info1:'',
|
info: '',
|
count: '',
|
showEmpty: true,
|
zyp: [
|
],
|
},
|
|
/**
|
* 生命周期函数--监听页面加载
|
*/
|
onLoad: function (options) {
|
this.getList();
|
},
|
onShow() {
|
this.setData({
|
showEmpty: true,
|
zyp: [
|
],
|
})
|
this.getList();
|
},
|
/**
|
* 请求后台获取数据
|
*/
|
getList: function () {
|
wx.showLoading({
|
title: '加载中',//加载转圈显示
|
});
|
var that = this;
|
var onRefresh = that.data.onRefresh;//false为重新刷新数据,true为分页累加数据
|
//请求后台数据
|
wx.request({
|
url: req_url + "/findtHandel",
|
data: {
|
phone:wx.getStorageSync('phone'),
|
ishandle: that.data.buttonColor,
|
username: wx.getStorageSync('username'),
|
'page': that.data.page,
|
'limit': that.data.pagesize,
|
},
|
method: 'get',
|
success: function (res) {
|
console.log(res);
|
var datas = res.data.data;
|
if (res.statusCode != 200) {
|
wx.showToast({
|
title: '获取数据失败',
|
icon: 'none',
|
duration: 2000
|
});
|
} else {
|
var zypd = []
|
if (datas != null && datas.length > 0) {
|
console.log(onRefresh);
|
if (!onRefresh) {//false为重新刷新数据,true为分页累加数据
|
// var zypd = []
|
datas.forEach(function (item, index) {
|
var json = {}
|
json.type = item.zyptype ,
|
json.phone = item.phone,
|
json.name = item.handelname,
|
json.number = item.zypcode,
|
json.time = item.applicationtime,
|
json.handle = item.ishandle,
|
json.local = item.local,
|
json.bumen = item.bumen,
|
json.opinion = item.opinion,
|
json.safetymeasure = item.safetymeasure,
|
json.issafetymeasure = item.issafetymeasure,
|
|
zypd.push(json)
|
});
|
if (that.data.buttonColor == 0) {
|
that.setData({
|
// onRefresh: true,
|
showEmpty: false,
|
count: res.data.data.length,
|
info: res.data.data.length,
|
zyp: that.data.zyp.concat(zypd),
|
page: that.data.page + 1
|
})
|
} else {
|
that.setData({
|
// onRefresh: true,
|
showEmpty: false,
|
info: res.data.data.length,
|
count: res.data.data.length,
|
zyp: that.data.zyp.concat(zypd),
|
page: that.data.page + 1
|
})
|
}
|
} else {
|
|
datas.forEach(function (item, index) {
|
var json = {}
|
json.type = item.zyptype ,
|
json.phone = item.phone,
|
json.name = item.handelname,
|
json.number = item.zypcode,
|
json.time = item.applicationtime,
|
json.handle = item.ishandle,
|
json.local = item.local,
|
json.bumen = item.bumen,
|
json.opinion = item.opinion,
|
json.safetymeasure = item.safetymeasure,
|
json.issafetymeasure = item.issafetymeasure,
|
zypd.push(json)
|
});
|
if (that.data.buttonColor == 0) {
|
that.setData({
|
showEmpty: false,
|
count: res.data.data.length,
|
info: res.data.data.length,
|
zyp: zypd, //重新覆盖list,
|
page: that.data.page + 1
|
})
|
} else {
|
that.setData({
|
showEmpty: false,
|
info: res.data.data.length,
|
count: res.data.data.length,
|
zyp: zypd, //重新覆盖list,
|
page: that.data.page + 1
|
})
|
}
|
|
}
|
|
} else {
|
wx.showToast({
|
title: '没有更多数据了',
|
icon: 'none'
|
})
|
|
if (res.data.data.length == 0) {
|
|
that.setData({
|
showEmpty: true,
|
info:undefined,
|
// showEmpty:false,
|
zyp: zypd, //重新覆盖list,
|
isloading: true
|
})
|
}
|
that.setData({
|
|
isloading: true
|
})
|
|
}
|
}
|
},
|
complete: function (res) {
|
wx.hideLoading();
|
},
|
fail: function (res) {
|
}
|
})
|
},
|
bindDownLoad: function () {
|
wx.showLoading({
|
title: '加载中',//加载转圈显示
|
});
|
setTimeout(() => {
|
|
this.setData({
|
buttonColor: 0,
|
page: 1,
|
pagesize: 10,
|
onRefresh: true, //重新加载数据
|
isLoading: false
|
})
|
|
this.getList();
|
wx.showNavigationBarLoading()
|
wx.hideNavigationBarLoading()
|
}, 1000)
|
},
|
onScrollToLower: function () {
|
// console.log(11111111111);
|
// console.log(this.data.count);
|
// if (this.data.count > 10) {
|
// wx.showLoading({
|
// title: '加载中',//加载转圈显示
|
// });
|
// var that = this;
|
// that.setData({
|
// onRefresh: false //累加数据
|
// });
|
// this.getList();
|
// }
|
},
|
daishen: function () {
|
this.setData({
|
page: 1,
|
buttonColor: 0,
|
onRefresh: true //重新加载数据
|
})
|
this.getList();
|
},
|
yishen: function () {
|
this.setData({
|
page: 1,
|
buttonColor: 1,
|
onRefresh: true //重新加载数据
|
})
|
this.getList();
|
},
|
bindViewTap: function (e) {
|
// json.issafetymeasure = item.issafetymeasure,
|
console.log(this.data.zyp);
|
console.log(this.data.zyp[e.currentTarget.dataset.index].issafetymeasure);
|
if (this.data.zyp[e.currentTarget.dataset.index].issafetymeasure=="动火作业") {
|
console.log(111111);
|
wx.navigateTo({
|
url: '../fireSafetymeasure/fireSafetymeasure?safetymeasure=' + this.data.zyp[e.currentTarget.dataset.index].safetymeasure+'&zypcode=' + this.data.zyp[e.currentTarget.dataset.index].number+'&bumen=' + this.data.zyp[e.currentTarget.dataset.index].bumen+'&opinion=' + this.data.zyp[e.currentTarget.dataset.index].opinion
|
})
|
}else if (this.data.zyp[e.currentTarget.dataset.index].issafetymeasure=="受限空间") {
|
wx.navigateTo({
|
url: '../SpanceSafetymeasure/SpanceSafetymeasure?safetymeasure=' + this.data.zyp[e.currentTarget.dataset.index].safetymeasure+'&zypcode=' + this.data.zyp[e.currentTarget.dataset.index].number+'&bumen=' + this.data.zyp[e.currentTarget.dataset.index].bumen+'&opinion=' + this.data.zyp[e.currentTarget.dataset.index].opinion
|
})
|
}else if (this.data.zyp[e.currentTarget.dataset.index].issafetymeasure=="高处安全") {
|
wx.navigateTo({
|
url: '../AltitudeSafetymeasure/AltitudeSafetymeasure?safetymeasure=' + this.data.zyp[e.currentTarget.dataset.index].safetymeasure+'&zypcode=' + this.data.zyp[e.currentTarget.dataset.index].number+'&bumen=' + this.data.zyp[e.currentTarget.dataset.index].bumen+'&opinion=' + this.data.zyp[e.currentTarget.dataset.index].opinion
|
})
|
}else if (this.data.zyp[e.currentTarget.dataset.index].issafetymeasure=="吊装安全") {
|
wx.navigateTo({
|
url: '../LiftingSafetymeasure/LiftingSafetymeasure?safetymeasure=' + this.data.zyp[e.currentTarget.dataset.index].safetymeasure+'&zypcode=' + this.data.zyp[e.currentTarget.dataset.index].number+'&bumen=' + this.data.zyp[e.currentTarget.dataset.index].bumen+'&opinion=' + this.data.zyp[e.currentTarget.dataset.index].opinion
|
})
|
}else if (this.data.zyp[e.currentTarget.dataset.index].issafetymeasure=="临时用电安全") {
|
wx.navigateTo({
|
url: '../ElectricitySafetymeasure/ElectricitySafetymeasure?safetymeasure=' + this.data.zyp[e.currentTarget.dataset.index].safetymeasure+'&zypcode=' + this.data.zyp[e.currentTarget.dataset.index].number+'&bumen=' + this.data.zyp[e.currentTarget.dataset.index].bumen+'&opinion=' + this.data.zyp[e.currentTarget.dataset.index].opinion
|
})
|
}else if (this.data.zyp[e.currentTarget.dataset.index].issafetymeasure=="动土安全") {
|
wx.navigateTo({
|
url: '../GroundSafetymeasure/GroundSafetymeasure?safetymeasure=' + this.data.zyp[e.currentTarget.dataset.index].safetymeasure+'&zypcode=' + this.data.zyp[e.currentTarget.dataset.index].number+'&bumen=' + this.data.zyp[e.currentTarget.dataset.index].bumen+'&opinion=' + this.data.zyp[e.currentTarget.dataset.index].opinion
|
})
|
}else if (this.data.zyp[e.currentTarget.dataset.index].issafetymeasure=="断路安全作业") {
|
wx.navigateTo({
|
url: '../CircuitSafetymeasure/CircuitSafetymeasure?safetymeasure=' + this.data.zyp[e.currentTarget.dataset.index].safetymeasure+'&zypcode=' + this.data.zyp[e.currentTarget.dataset.index].number+'&bumen=' + this.data.zyp[e.currentTarget.dataset.index].bumen+'&opinion=' + this.data.zyp[e.currentTarget.dataset.index].opinion
|
})
|
}else if (this.data.zyp[e.currentTarget.dataset.index].issafetymeasure=="盲板抽堵安全") {
|
wx.navigateTo({
|
url: '../BilndSafetymeasure/BilndSafetymeasure?safetymeasure=' + this.data.zyp[e.currentTarget.dataset.index].safetymeasure+'&zypcode=' + this.data.zyp[e.currentTarget.dataset.index].number+'&bumen=' + this.data.zyp[e.currentTarget.dataset.index].bumen+'&opinion=' + this.data.zyp[e.currentTarget.dataset.index].opinion
|
})
|
}else{
|
console.log(e);
|
console.log(this.data.zyp[e.currentTarget.dataset.index].opinion);
|
wx.navigateTo({
|
url: '../handle/handle?zypcode=' + this.data.zyp[e.currentTarget.dataset.index].number + '&zyptepe=' + this.data.zyp[e.currentTarget.dataset.index].type + '&bumen=' + this.data.zyp[e.currentTarget.dataset.index].bumen + '&opinion=' + this.data.zyp[e.currentTarget.dataset.index].opinion+ '&safetymeasure=' + this.data.zyp[e.currentTarget.dataset.index].safetymeasure
|
})
|
}
|
|
},
|
onClick() {
|
var that = this;
|
if (that.data.value === '') {
|
that.setData({
|
total: 0, //分页总数
|
page: 1, //分页记录数
|
pagesize: 10,
|
onRefresh: true
|
})
|
this.getList()
|
} else {
|
var onRefresh = that.data.onRefresh;//false为重新刷新数据,true为分页累加数据
|
|
wx.request({
|
url: req_url + "/findHandelSearch",
|
data: {
|
phone:wx.getStorageSync('phone'),
|
ishandle: that.data.buttonColor,
|
username: wx.getStorageSync('username'),
|
code: that.data.value,
|
'page': 1,
|
'limit': that.data.pagesize,
|
},
|
verify: false,
|
loading: true,
|
title: '请稍后...',
|
success: (res) => {
|
|
var datas = res.data;
|
if (res.statusCode != 200) {
|
wx.showToast({
|
title: '搜索失败',
|
icon: 'none',
|
duration: 2000
|
});
|
} else {
|
var zypd = []
|
if (datas != null && datas.length > 0) {
|
if (!onRefresh) {//false为重新刷新数据,true为分页累加数据
|
datas.forEach(function (item, index) {
|
var json = {}
|
json.type = item.zyptype,
|
|
json.phone = item.phone,
|
json.name = item.handelname,
|
json.number = item.zypcode,
|
json.time = item.applicationtime,
|
json.handle = item.ishandle,
|
json.local = item.local,
|
json.safetymeasure = item.safetymeasure,
|
json.issafetymeasure = item.issafetymeasure,
|
zypd.push(json)
|
});
|
if (that.data.buttonColor == 0) {
|
that.setData({
|
showEmpty: false,
|
count: res.data.data.length,
|
info: res.data.data.length,
|
zyp: that.data.zyp.concat(zypd),
|
page: that.data.page + 1
|
})
|
} else {
|
that.setData({
|
showEmpty: false,
|
info: res.data.data.length,
|
count: res.data.data.length,
|
// zyp: zypd,
|
zyp: that.data.zyp.concat(zypd),
|
page: that.data.page + 1
|
})
|
}
|
} else {
|
datas.forEach(function (item, index) {
|
var json = {}
|
json.type = item.zyptype,
|
json.phone = item.phone,
|
json.name = item.handelname,
|
json.number = item.zypcode,
|
json.time = item.applicationtime,
|
json.handle = item.ishandle,
|
json.local = item.local,
|
json.safetymeasure = item.safetymeasure,
|
json.issafetymeasure = item.issafetymeasure,
|
zypd.push(json)
|
});
|
|
if (that.data.buttonColor == 0) {
|
that.setData({
|
showEmpty: false,
|
count: res.data.data.length,
|
info: res.data.data.length,
|
zyp: zypd, //重新覆盖list,
|
page: that.data.page + 1
|
})
|
} else {
|
that.setData({
|
showEmpty: false,
|
info: res.data.data.length,
|
count: res.data.data.length,
|
zyp: zypd, //重新覆盖list,
|
page: that.data.page + 1
|
})
|
}
|
}
|
} else {
|
wx.showToast({
|
title: '没有更多数据了',
|
icon: 'none'
|
})
|
if (res.data.data.length == 0) {
|
that.setData({
|
showEmpty: true,
|
zyp: zypd, //重新覆盖list,
|
isloading: true
|
})
|
}
|
that.setData({
|
isloading: true
|
})
|
}
|
}
|
}
|
})
|
}
|
},
|
onChange(e) {
|
this.setData({
|
value: e.detail,
|
});
|
},
|
itemPdfOn(e) {
|
console.log(e);
|
wx.showLoading({
|
title: '加载中',
|
})
|
wx.redirectTo({
|
url: `/pages/details/details?num=` + e.currentTarget.dataset.num + `&type=` + e.currentTarget.dataset.type + `&local=` + e.currentTarget.dataset.local + `&phone=` + e.currentTarget.dataset.phone+ `&name=` + e.currentTarget.dataset.name
|
})
|
// if (e.currentTarget.dataset.type == "受限空间作业") {
|
// wx.redirectTo({
|
// url: `/pages/Zypspace/Zypspace?num=` + e.currentTarget.dataset.num + `&handle=` + e.currentTarget.dataset.handle + `&bumen=` + e.currentTarget.dataset.bumen
|
// })
|
// } else if (e.currentTarget.dataset.type == "动火作业") {
|
// wx.redirectTo({
|
// url: `/pages/Zypfire/Zypfire?num=` + e.currentTarget.dataset.num + `&handle=` + e.currentTarget.dataset.handle+ `&bumen=` + e.currentTarget.dataset.bumen
|
// })
|
// } else if (e.currentTarget.dataset.type == "吊装安全作业") {
|
// wx.redirectTo({
|
// url: `/pages/Zyplifting/Zyplifting?num=` + e.currentTarget.dataset.num + `&handle=` + e.currentTarget.dataset.handle+ `&bumen=` + e.currentTarget.dataset.bumen
|
// })
|
// } else if (e.currentTarget.dataset.type == "动土安全作业") {
|
// wx.redirectTo({
|
// url: `/pages/ZypGround/ZypGround?num=` + e.currentTarget.dataset.num + `&handle=` + e.currentTarget.dataset.handle+ `&bumen=` + e.currentTarget.dataset.bumen
|
// })
|
// } else if (e.currentTarget.dataset.type == "高处安全作业") {
|
// wx.redirectTo({
|
// url: `/pages/ZypAltitude/ZypAltitude?num=` + e.currentTarget.dataset.num + `&handle=` + e.currentTarget.dataset.handle+ `&bumen=` + e.currentTarget.dataset.bumen
|
// })
|
// } else if (e.currentTarget.dataset.type == "断路安全作业") {
|
// wx.redirectTo({
|
// url: `/pages/ZypCircuit/ZypCircuit?num=` + e.currentTarget.dataset.num + `&handle=` + e.currentTarget.dataset.handle+ `&bumen=` + e.currentTarget.dataset.bumen
|
// })
|
// } else if (e.currentTarget.dataset.type == "临时用电作业") {
|
// wx.redirectTo({
|
// url: `/pages/ZypElectricity/ZypElectricity?num=` + e.currentTarget.dataset.num + `&handle=` + e.currentTarget.dataset.handle+ `&bumen=` + e.currentTarget.dataset.bumen
|
// })
|
// } else if (e.currentTarget.dataset.type == "盲板抽堵作业") {
|
// wx.redirectTo({
|
// url: `/pages/ZypBlind/ZypBlind?num=` + e.currentTarget.dataset.num + `&handle=` + e.currentTarget.dataset.handle+ `&bumen=` + e.currentTarget.dataset.bumen
|
// })
|
// }
|
|
|
|
},
|
onSearch() {
|
var that = this;
|
if (that.data.value === '') {
|
that.setData({
|
total: 0, //分页总数
|
page: 1, //分页记录数
|
pagesize: 10,
|
onRefresh: true
|
})
|
this.getList()
|
} else {
|
var onRefresh = that.data.onRefresh;//false为重新刷新数据,true为分页累加数据
|
|
wx.request({
|
url: req_url + "/findHandelSearch",
|
data: {
|
phone:wx.getStorageSync('phone'),
|
ishandle: that.data.buttonColor,
|
username: wx.getStorageSync('username'),
|
code: that.data.value,
|
'page': 1,
|
'limit': that.data.pagesize,
|
},
|
verify: false,
|
loading: true,
|
title: '请稍后...',
|
success: (res) => {
|
|
var datas = res.data;
|
if (res.statusCode != 200) {
|
wx.showToast({
|
title: '搜索失败',
|
icon: 'none',
|
duration: 2000
|
});
|
} else {
|
var zypd = []
|
if (datas != null && datas.length > 0) {
|
if (!onRefresh) {//false为重新刷新数据,true为分页累加数据
|
datas.forEach(function (item, index) {
|
var json = {}
|
json.type = item.zyptype ,
|
json.phone = item.phone,
|
json.name = item.handelname,
|
json.number = item.zypcode,
|
json.time = item.applicationtime,
|
json.handle = item.ishandle,
|
json.safetymeasure = item.safetymeasure,
|
json.issafetymeasure = item.issafetymeasure,
|
json.local = item.local,
|
zypd.push(json)
|
});
|
if (that.data.buttonColor == 0) {
|
that.setData({
|
showEmpty: false,
|
count: res.data.data.length,
|
info: res.data.data.length,
|
zyp: that.data.zyp.concat(zypd),
|
page: that.data.page + 1
|
})
|
} else {
|
that.setData({
|
showEmpty: false,
|
info: res.data.data.length,
|
count: res.data.data.length,
|
// zyp: zypd,
|
zyp: that.data.zyp.concat(zypd),
|
page: that.data.page + 1
|
})
|
}
|
} else {
|
datas.forEach(function (item, index) {
|
var json = {}
|
json.type = item.zyptype,
|
json.phone = item.phone,
|
json.name = item.handelname,
|
json.number = item.zypcode,
|
json.time = item.applicationtime,
|
json.handle = item.ishandle,
|
json.safetymeasure = item.safetymeasure,
|
json.issafetymeasure = item.issafetymeasure,
|
json.local = item.local,
|
zypd.push(json)
|
});
|
|
if (that.data.buttonColor == 0) {
|
that.setData({
|
showEmpty: false,
|
count: res.data.data.length,
|
info: res.data.data.length,
|
zyp: zypd, //重新覆盖list,
|
page: that.data.page + 1
|
})
|
} else {
|
that.setData({
|
showEmpty: false,
|
info: res.data.data.length,
|
count: res.data.data.length,
|
zyp: zypd, //重新覆盖list,
|
page: that.data.page + 1
|
})
|
}
|
}
|
} else {
|
wx.showToast({
|
title: '没有更多数据了',
|
icon: 'none'
|
})
|
if (res.data.data.length == 0) {
|
that.setData({
|
showEmpty: true,
|
zyp: zypd, //重新覆盖list,
|
isloading: true
|
})
|
}
|
that.setData({
|
isloading: true
|
})
|
}
|
}
|
}
|
})
|
}
|
},
|
methods: {
|
|
},
|
})
|