diff --git a/app.js b/app.js index 2036e08..a75ea24 100644 --- a/app.js +++ b/app.js @@ -74,8 +74,8 @@ App({ }, globalData: { userInfo: null, - serverUrl: 'https://safeyun.ctcshe.com/', - //serverUrl: 'http://127.0.0.1:8000/', + //serverUrl: 'https://safeyun.ctcshe.com/', + serverUrl: 'http://127.0.0.1:8000/', //serverUrl: 'http://192.168.0.102:8000/', //serverUrl:'http://10.7.100.250:8000/', isaqy: 0, diff --git a/app.json b/app.json index 4a6506b..9de8a63 100644 --- a/app.json +++ b/app.json @@ -61,7 +61,9 @@ "pages/inspect/detail", "pages/equipment/detail", "pages/risk/myindex", - "pages/risk/detail" + "pages/risk/detail", + "pages/risktask/index", + "pages/risktask/check" ], "window": { "backgroundTextStyle": "light", diff --git a/pages/images/task.png b/pages/images/task.png new file mode 100644 index 0000000..285dcc6 Binary files /dev/null and b/pages/images/task.png differ diff --git a/pages/main/main.wxml b/pages/main/main.wxml index 7dd753e..0090b14 100644 --- a/pages/main/main.wxml +++ b/pages/main/main.wxml @@ -2,6 +2,11 @@ 数据采集 + + + 排查任务 + + 事故隐患 diff --git a/pages/risktask/check.js b/pages/risktask/check.js new file mode 100644 index 0000000..886af98 --- /dev/null +++ b/pages/risktask/check.js @@ -0,0 +1,112 @@ +// pages/risktask/check.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + page:1, + riskact:0, + group:0 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log(options) + this.data.riskact = options.riskact + this.data.group = options.group + this.getlist() + }, + getlist:function(){ + var page = this.data.page + wx.request({ + url: getApp().globalData.serverUrl + 'api/risktask?a=listtask&rows=10&page=' + page + '&group=' + this.data.group + '&riskact=' + this.data.riskact, + header: { + 'content-type': 'application/json', // 默认值 + 'Cookie': wx.getStorageSync("sessionid"), + }, + success: res => { + if (res.statusCode === 200) { + console.log(res.data) + if (res.data.rows.length == 0) { + if (page == 1) { + this.setData({ + total: 0, + alllist: [] + }) + } + else { + wx.showModal({ + content: "已经到底啦!", + showCancel: false, + confirmText: "确定", + }) + } + } else { + let list + if (page == 1) { + list = res.data.rows + } else { + list = this.data.alllist.concat(res.data.rows) + } + this.setData({ + total: res.data.total, + alllist: list + }) + } + } + wx.hideLoading(); + } + }); + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/risktask/check.json b/pages/risktask/check.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/risktask/check.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/risktask/check.wxml b/pages/risktask/check.wxml new file mode 100644 index 0000000..9554f7e --- /dev/null +++ b/pages/risktask/check.wxml @@ -0,0 +1,47 @@ + 共{{total}}条风险 + + + + + + 低风险 + 一般风险 + 较大风险 + 重大风险 + {{item.risk__step}} + + + 标准/危害因素 + {{item.risk__hazard}} + + + 工程技术 + {{item.risk__measure1}} + + + + 管理措施 + {{item.risk__measure2}} + + + + 培训教育 + {{item.risk__measure3}} + + + + 个体防护 + {{item.risk__measure4}} + + + + 应急处理 + {{item.risk__measure5}} + + + 确认已排查 + + + + + diff --git a/pages/risktask/check.wxss b/pages/risktask/check.wxss new file mode 100644 index 0000000..ef15154 --- /dev/null +++ b/pages/risktask/check.wxss @@ -0,0 +1,14 @@ +.weui-btn{ + width:auto; + margin: 5px; +} +.container { + background-color: #fff; + color: #939393; +} +.head{ + color:#fff; + background-color: cornflowerblue; + text-align: center; +} + \ No newline at end of file diff --git a/pages/risktask/index.js b/pages/risktask/index.js new file mode 100644 index 0000000..1c0aad3 --- /dev/null +++ b/pages/risktask/index.js @@ -0,0 +1,277 @@ +// pages/suggest/suggest.js +var sliderWidth = 96; +Page({ + + /** + * 页面的初始数据 + */ + data: { + page: 1, + serverUrl: getApp().globalData.serverUrl, + alllist: [], + tabs: ["我的已查", "我的待查", "全厂待办"], + activeIndex: 1, + sliderOffset: 0, + sliderLeft: 0 + }, + tabClick: function (e) { + var that = this + that.setData({ + sliderOffset: e.currentTarget.offsetLeft, + activeIndex: e.currentTarget.id + }); + if (that.data.activeIndex == 0) { + that.getmylist(1) + that.data.mypage = 1 + } + else if (that.data.activeIndex == 1) { + that.gettodolist(1) + that.data.todopage = 1 + } + else if (that.data.activeIndex == 2) { + that.getalllist(1) + that.data.page = 1 + } + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var that = this; + wx.getSystemInfo({ + success: function (res) { + that.setData({ + sliderLeft: (res.windowWidth / that.data.tabs.length - sliderWidth) / 2, + sliderOffset: res.windowWidth / that.data.tabs.length * that.data.activeIndex + }); + } + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + var that = this; + console.log(that.data.activeIndex) + if (that.data.activeIndex == 0) { + that.getmylist(1) + that.data.mypage = 1 + } + else if (that.data.activeIndex == 1) { + that.gettodolist(1) + that.data.todopage = 1 + } + else if (that.data.activeIndex == 2) { + that.getalllist(1) + this.data.page = 1; + } + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + var that = this; + if (that.data.activeIndex == 0) { + that.getmylist(1) + wx.stopPullDownRefresh(); + that.data.mypage = 1 + } + else if (that.data.activeIndex == 1) { + that.gettodolist(1) + wx.stopPullDownRefresh(); + that.data.todopage = 1 + } + else if (that.data.activeIndex == 2) { + that.getalllist(1) + wx.stopPullDownRefresh(); + that.data.page = 1 + } + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + //上拉分页,将页码加1,然后调用分页函数 + var that = this; + if (that.data.activeIndex == 0) { + this.data.mypage = this.data.mypage + 1; + this.getmylist(); + } + else if (that.data.activeIndex == 1) { + this.data.todopage = this.data.todopage + 1; + this.gettodolist(); + } + else if (that.data.activeIndex == 2) { + this.data.page = this.data.page + 1; + this.getalllist(); + } + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + getalllist: function (page) { + var that = this; + if (page != 1) { page = that.data.page } + wx.showLoading({ + title: '加载中', + }), + wx.request({ + url: this.data.serverUrl + 'api/risktask?a=listalltodo&rows=10&page=' + page, + header: { + 'content-type': 'application/json', // 默认值 + 'Cookie': wx.getStorageSync("sessionid"), + }, + success: res => { + if (res.statusCode === 200) { + if (res.data.rows.length == 0) { + if (page == 1) { + this.setData({ + total: 0, + alllist: [] + }) + } + else { + wx.showModal({ + content: "已经到底啦!", + showCancel: false, + confirmText: "确定", + }) + } + } else { + let list + if (page == 1) { + list = res.data.rows + } else { + list = this.data.alllist.concat(res.data.rows) + } + this.setData({ + total: res.data.total, + alllist: list + }) + } + } + wx.hideLoading(); + } + }); + }, + getmylist: function (page) { + var that = this; + if (page != 1) { page = that.data.mypage } + wx.showLoading({ + title: '加载中', + }), + wx.request({ + url: this.data.serverUrl + 'api/suggest?a=listself&rows=10&page=' + page, + header: { + 'content-type': 'application/json', // 默认值 + 'Cookie': wx.getStorageSync("sessionid"), + }, + success: res => { + if (res.statusCode === 200) { + if (res.data.rows.length == 0) { + if (page == 1) { + this.setData({ + donetotal: 0, + donelist: [] + }) + } + else { + wx.showModal({ + content: "已经到底啦!", + showCancel: false, + confirmText: "确定", + }) + } + } else { + let list + if (page == 1) { + list = res.data.rows + } else { + list = this.data.donelist.concat(res.data.rows) + } + this.setData({ + donetotal: res.data.total, + donelist: list + }) + } + } + wx.hideLoading(); + } + }); + }, + gettodolist: function (page) { + var that = this; + if (page != 1) { page = that.data.todopage } + wx.showLoading({ + title: '加载中', + }), + wx.request({ + url: this.data.serverUrl + 'api/risktask?a=list2todo&rows=10&page=' + page, + header: { + 'content-type': 'application/json', // 默认值 + 'Cookie': wx.getStorageSync("sessionid"), + }, + success: res => { + if (res.statusCode === 200) { + console.log(res.data) + if (res.data.rows.length == 0) { + if (page == 1) { + this.setData({ + todototal: 0, + todolist: [] + }) + } + else { + wx.showModal({ + content: "已经到底啦!", + showCancel: false, + confirmText: "确定", + }) + } + } else { + let list + if (page == 1) { + list = res.data.rows + } else { + list = this.data.todolist.concat(res.data.rows) + } + this.setData({ + todototal: res.data.total, + todolist: list + }) + } + } + wx.hideLoading(); + } + }); + }, +}) \ No newline at end of file diff --git a/pages/risktask/index.json b/pages/risktask/index.json new file mode 100644 index 0000000..7bdce1d --- /dev/null +++ b/pages/risktask/index.json @@ -0,0 +1,5 @@ +{ + "navigationBarTitleText": "排查任务", + "enablePullDownRefresh": true, + "onReachBottomDistance": 20 +} \ No newline at end of file diff --git a/pages/risktask/index.wxml b/pages/risktask/index.wxml new file mode 100644 index 0000000..4619108 --- /dev/null +++ b/pages/risktask/index.wxml @@ -0,0 +1,95 @@ + + + + + {{item}} + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/risktask/index.wxss b/pages/risktask/index.wxss new file mode 100644 index 0000000..ef15154 --- /dev/null +++ b/pages/risktask/index.wxss @@ -0,0 +1,14 @@ +.weui-btn{ + width:auto; + margin: 5px; +} +.container { + background-color: #fff; + color: #939393; +} +.head{ + color:#fff; + background-color: cornflowerblue; + text-align: center; +} + \ No newline at end of file