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.

169 lines
3.5 KiB

// package/bindTroubleshooting/index.js
import { getPatrolRecordIssueHandle } from "../../utils/getApiUrl";
import { Request } from "../../common";
const moment = require("../../utils/moment");
Page({
/**
* 页面的初始数据
*/
data: {
dataList: [],
currentTab: '0',
// 筛选选择
structList: ['a', 'b', 'c'],
structResult: ['a', 'b'],
pointList: ['a', 'b', 'c'],
pointResult: ['a', 'b'],
// 时间筛选
startTime: '',
endTime: ''
},
// 顶部tab切换
clickTab (e) {
this.setData({
currentTab: e.currentTarget.dataset.current
})
if (e.currentTarget.dataset.current == '0') {
} else if (e.currentTarget.dataset.current == '1') {
}
this.setData({
page: 0,
dataList: []
}, () => {
this.getData({
type: e.currentTarget.dataset.current == '0' ? 'backlog' : 'haveDone'
});
})
},
getData (params) {
Request.get(getPatrolRecordIssueHandle(), {
...params,
}).then(res => {
console.log(res);
this.setData({
dataList: res.map(r => {
return {
...r,
createTime: r.createTime ? moment(r.createTime).format('YYYY-MM-DD HH:mm:ss') : '--'
}
})
})
})
},
// 筛选选择
onStructChange (event) {
this.setData({
structResult: event.detail,
});
},
structToggle (event) {
const { index } = event.currentTarget.dataset;
const checkbox = this.selectComponent(`.checkboxes-struct-${index}`);
checkbox.toggle();
},
onPointChange (event) {
this.setData({
pointResult: event.detail,
});
},
pointToggle (event) {
const { index } = event.currentTarget.dataset;
const checkbox = this.selectComponent(`.checkboxes-point-${index}`);
checkbox.toggle();
},
noop () { },
// 时间选择
onStartTimeChange (event) {
this.setData({
startTime: event.detail,
});
},
onEndTimeChange (event) {
this.setData({
endTime: event.detail,
});
},
search () {
console.log(this.data);
},
// 页面跳转
toShootingForm (e) {
console.log(e);
const { shootingid } = e.currentTarget.dataset
wx.navigateTo({
url: '/package/troubleshooting/shootingForm/index?shootingid=' + shootingid + '&tabIndex=' + this.data.currentTab,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady () {
console.log(123);
this.getData({
type: 'backlog'
});
},
/**
* 生命周期函数--监听页面显示
*/
onShow () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage () {
}
})