180 lines
3.4 KiB
JavaScript
180 lines
3.4 KiB
JavaScript
const app = getApp();
|
|
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
topBarH: app.globalData.CustomBar,
|
|
curTab: 0,
|
|
tabs: [{
|
|
lab: '待办事项',
|
|
val: 0
|
|
}, {
|
|
lab: '已办事项',
|
|
val: 1
|
|
}],
|
|
|
|
page: 1,
|
|
pageSize: 10,
|
|
list: []
|
|
},
|
|
|
|
/**
|
|
* 输入内容
|
|
*/
|
|
inputContent: function (e) {
|
|
const name = e.currentTarget.dataset.name;
|
|
this.data[name] = e.detail.value;
|
|
this.refresh();
|
|
},
|
|
|
|
/**
|
|
* 切换筛选
|
|
*/
|
|
tabSelect: function (params) {
|
|
const index = params.currentTarget.dataset.index;
|
|
this.data.curTab = index;
|
|
this.data.freshIng = true;
|
|
this.setData(this.data)
|
|
},
|
|
|
|
/**
|
|
* 时间筛选
|
|
*/
|
|
bindDateChange: function (params) {
|
|
const name = params.currentTarget.dataset.name;
|
|
this.data[name] = params.detail.value;
|
|
this.data.freshIng = true;
|
|
this.setData(this.data);
|
|
},
|
|
|
|
/**
|
|
* 刷新
|
|
*/
|
|
refresh: function (params) {
|
|
this.data.page = 1;
|
|
this.getList();
|
|
},
|
|
|
|
/**
|
|
* 获取列表
|
|
*/
|
|
getList: function () {
|
|
// console.log(this.data.curTab,parseInt(this.data.curTab) + 1,'=====>');
|
|
app.axios("GET", "app", "/work/sendWorkPage", {
|
|
page: this.data.page,
|
|
limit: this.data.pageSize,
|
|
startTime: this.data.startTime || '',
|
|
endTime: this.data.endTime || '',
|
|
condition: this.data.condition || '',
|
|
userId: app.globalData.userInfo.userId
|
|
}, false).then(res => {
|
|
console.log(res,'res====>');
|
|
this.data.freshIng = false;
|
|
if (res.code == 1) {
|
|
let page = Number.parseInt(res.data.pageNum);
|
|
if (this.data.page == 1) {
|
|
this.data.list = res.data.list;
|
|
} else {
|
|
var list = this.data.list;
|
|
if (this.data.page == page) this.data.list = [...list, ...res.data.list]
|
|
}
|
|
if (res.data.list?.length > 0) this.data.page = page + 1
|
|
}
|
|
this.setData(this.data)
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 跳转详情
|
|
*/
|
|
toDetail: function (params) {
|
|
const item = params.currentTarget.dataset.item.workId;
|
|
console.log(item,'item==>');
|
|
wx.navigateTo({
|
|
url: `/pages/work/f-b-g-z/serve/index?workId=${item}&detail=1`,
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 前往上传
|
|
*/
|
|
toUp: function (params) {
|
|
const item = params.currentTarget.dataset.item;
|
|
const detail = params.currentTarget.dataset.detail;
|
|
wx.navigateTo({
|
|
url: `/pages/work/d-b-s-x/up/index?detail=${detail}`,
|
|
success: res => {
|
|
res.eventChannel.emit('getItem', item)
|
|
}
|
|
})
|
|
},
|
|
/**
|
|
* 发布工作
|
|
*/
|
|
escalationAppeal: function (params) {
|
|
wx.navigateTo({
|
|
url: `/pages/work/f-b-g-z/serve/index`,
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
// this.data.curTab = options.id;
|
|
this.data.freshIng = true;
|
|
this.setData(this.data)
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage() {
|
|
|
|
}
|
|
}) |