From febb676688664906991122bc0532e527959b2054 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Sun, 18 Aug 2019 16:30:56 +0800 Subject: [PATCH] xx20190818 --- app.json | 5 +- pages/examtest/main.js | 3 +- pages/images/risk.png | Bin 0 -> 582 bytes pages/main/main.js | 25 +++- pages/main/main.wxml | 6 +- pages/risk/detail.js | 4 + pages/risk/detail.wxml | 19 +-- pages/risk/myindex.js | 10 +- pages/risk/myindex.json | 4 +- pages/riskact/check.js | 153 +++++++++++++++++++++++ pages/riskact/check.json | 3 + pages/riskact/check.wxml | 51 ++++++++ pages/riskact/check.wxss | 14 +++ pages/riskact/detail.js | 101 +++++++++++++++ pages/riskact/detail.json | 3 + pages/riskact/detail.wxml | 33 +++++ pages/riskact/detail.wxss | 1 + pages/riskact/index.js | 215 ++++++++++++++++++++++++++++++++ pages/riskact/index.json | 5 + pages/riskact/index.wxml | 78 ++++++++++++ pages/riskact/index.wxss | 14 +++ pages/risktask/index.js | 2 +- pages/risktask/index.wxml | 17 ++- pages/trouble/addtrouble.js | 27 ++++ pages/trouble/addtrouble.wxml | 1 + pages/trouble/addtroublezg.js | 13 ++ pages/trouble/addtroublezg.wxml | 1 + pages/trouble/addtroublezp.js | 13 ++ pages/trouble/addtroublezp.wxml | 2 + 29 files changed, 800 insertions(+), 23 deletions(-) create mode 100644 pages/images/risk.png create mode 100644 pages/riskact/check.js create mode 100644 pages/riskact/check.json create mode 100644 pages/riskact/check.wxml create mode 100644 pages/riskact/check.wxss create mode 100644 pages/riskact/detail.js create mode 100644 pages/riskact/detail.json create mode 100644 pages/riskact/detail.wxml create mode 100644 pages/riskact/detail.wxss create mode 100644 pages/riskact/index.js create mode 100644 pages/riskact/index.json create mode 100644 pages/riskact/index.wxml create mode 100644 pages/riskact/index.wxss diff --git a/app.json b/app.json index 56e16ee..1348412 100644 --- a/app.json +++ b/app.json @@ -64,7 +64,10 @@ "pages/risk/detail", "pages/risktask/index", "pages/risktask/check", - "pages/risktask/main" + "pages/risktask/main", + "pages/riskact/index", + "pages/riskact/detail", + "pages/riskact/check" ], "window": { "backgroundTextStyle": "light", diff --git a/pages/examtest/main.js b/pages/examtest/main.js index bd3eaf1..7a93cfb 100644 --- a/pages/examtest/main.js +++ b/pages/examtest/main.js @@ -76,7 +76,7 @@ Page({ }, success: res => { if (res.statusCode === 200) { - wx.hideLoading() + console.log(res.data) let tms = res.data this.tmdata = tms @@ -88,6 +88,7 @@ Page({ this.setData({ tmtotal: tms.tms.length, starttime: util.formatTime(new Date()) }) + wx.hideLoading() } } diff --git a/pages/images/risk.png b/pages/images/risk.png new file mode 100644 index 0000000000000000000000000000000000000000..88969528e8e4a43f368333476473b0227e16cd75 GIT binary patch literal 582 zcmV-M0=fN(P)0s?ZI)Dyl4`f-?sDueY_A&4M8*lRe zOqfX~z-0f>D8YkFcGkhp4Ldy-g^K)@rLU`7h-MpWGpwHH=pOJQx5sW;nTC=@mVh9+yoBw%Pv z0*1yUpaW7;i0)91Lx9B5=$p~O{R%J~2S{Nxjx8i{c@q8eI0Oi69()P}T)(~ql%|6h zRX_A71f&oCs?#kmtKI~}m>c}<#v&kp=~o~ifv|>UN%bLMXR(HLN$p=i%UhGKNY&IU(N=;i@~gLFSZv zEkfedJ9&vqZ?87`IMAnv%*&G#xhRj1kv9&)`V&#rc}}DIMM(-PujFeH)s{LkqJHxB zO8HVqbwR&akk1E;`YWTVU%Z<>M;{UOXQqc((cS-1l0wRU|MhM4{O6M+J{i+~099MY U>}AOXRsaA107*qoM6N<$g1dnK)&Kwi literal 0 HcmV?d00001 diff --git a/pages/main/main.js b/pages/main/main.js index 54c9967..bf266e3 100644 --- a/pages/main/main.js +++ b/pages/main/main.js @@ -12,7 +12,8 @@ Page({ dknum:0, gcnoread:0, wsnoread:0, - jytodonum:0 + jytodonum:0, + tasknum:0, }, /** @@ -42,6 +43,7 @@ Page({ this.getgcnoreadnum() this.getwsnoreadnum()//未遂未读 this.getjytodonum() + this.gettasknum() }else{ getApp().callback = () => { this.getnoread() @@ -51,6 +53,7 @@ Page({ this.getdknum() this.getgcnoreadnum() this.getjytodonum() + this.gettasknum() }; } @@ -248,6 +251,26 @@ Page({ } }); }, + gettasknum: function () { + var that = this + //获取待考 + wx.request({ + url: getApp().globalData.serverUrl + 'api/risktask?a=todonum', + header: { + 'content-type': 'application/json', // 默认值 + 'Cookie': wx.getStorageSync("sessionid"), + }, + data: {}, + success: res => { + if (res.statusCode === 200) { + //console.log(res.data) + this.setData({ + tasknum: res.data.todonum, + }) + } + } + }); + }, taptest:function(){ if(getApp().globalData.rights != undefined){ if (getApp().globalData.rights.indexOf('25') != -1) {//考试功能 diff --git a/pages/main/main.wxml b/pages/main/main.wxml index 0090b14..e0ae4bb 100644 --- a/pages/main/main.wxml +++ b/pages/main/main.wxml @@ -5,7 +5,7 @@ 排查任务 - + {{tasknum}} @@ -32,6 +32,10 @@ 作业许可 {{zytodonum}} + + + 风险管控 + 设备巡检 diff --git a/pages/risk/detail.js b/pages/risk/detail.js index 25302bb..bb92b73 100644 --- a/pages/risk/detail.js +++ b/pages/risk/detail.js @@ -12,6 +12,9 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { + wx.showLoading({ + title: '', + }) wx.request({ url: getApp().globalData.serverUrl + 'api/risk?a=detail&id=' + options.id, header: { @@ -23,6 +26,7 @@ Page({ if (res.statusCode === 200) { //console.log(res.data) this.setData(res.data) + wx.hideLoading() } } }) diff --git a/pages/risk/detail.wxml b/pages/risk/detail.wxml index 0b7f595..326c98c 100644 --- a/pages/risk/detail.wxml +++ b/pages/risk/detail.wxml @@ -34,9 +34,7 @@ - - 危害因素 - + 危害因素/标准 {{hazard}} @@ -70,24 +68,29 @@ 工程技术措施 - {{measure1}} + {{measure1}} + 管理措施措施 - {{measure2}} + {{measure2}} + 培训教育措施 - {{measure3}} + {{measure3}} + 个体防护措施 - {{measure4}} + {{measure4}} + 应急防护措施 - {{measure5}} + {{measure5}} + diff --git a/pages/risk/myindex.js b/pages/risk/myindex.js index 1103b93..c8699aa 100644 --- a/pages/risk/myindex.js +++ b/pages/risk/myindex.js @@ -12,8 +12,15 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { + var url = getApp().globalData.serverUrl + 'api/risk?a=listself' + if(options.a=='listall'){ + url = getApp().globalData.serverUrl + 'api/risk?a=listall&riskact='+options.riskact + } + wx.showLoading({ + title: '', + }) wx.request({ - url: getApp().globalData.serverUrl + 'api/risk?a=listself', + url: url, header: { 'content-type': 'application/json', // 'Cookie': wx.getStorageSync("sessionid"), @@ -24,6 +31,7 @@ Page({ this.setData({ fxlist:res.data.rows }) + wx.hideLoading() } } }) diff --git a/pages/risk/myindex.json b/pages/risk/myindex.json index db1e39d..9e26dfe 100644 --- a/pages/risk/myindex.json +++ b/pages/risk/myindex.json @@ -1,3 +1 @@ -{ - "navigationBarTitleText": "岗位风险" -} \ No newline at end of file +{} \ No newline at end of file diff --git a/pages/riskact/check.js b/pages/riskact/check.js new file mode 100644 index 0000000..9321355 --- /dev/null +++ b/pages/riskact/check.js @@ -0,0 +1,153 @@ +// pages/risktask/check.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + page: 1, + riskact: 0, + group: 0 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log(options) + this.data.riskact = options.riskact + this.getlist() + }, + getlist: function () { + var page = this.data.page + wx.showLoading({ + title: '加载中', + }) + wx.request({ + url: getApp().globalData.serverUrl + 'api/risk?a=listall&riskact=' + this.data.riskact, + header: { + 'content-type': 'application/json', // 默认值 + 'Cookie': wx.getStorageSync("sessionid"), + }, + success: res => { + if (res.statusCode === 200) { + wx.hideLoading() + 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 () { + + }, + open: function (e) { + console.log(e) + wx.navigateTo({ + url: '/pages/trouble/addtrouble?type=riskcheck&index=' + e.currentTarget.dataset.index, + }) + }, + submit: function () { + console.log(this.data.alllist) + let alllist = this.data.alllist + let data = {'checks':[]} + for (var i = 0; i < alllist.length; i++) { + if (i.trouble != undefined){ + data.checks.push({ 'id': alllist[i].id }) + } + else{ + data.checks.push({ 'id': alllist[i].id, 'trouble': alllist[i].trouble }) + } + } + wx.showLoading({ + title: '提交中', + }) + wx.request({ + url: getApp().globalData.serverUrl + 'api/riskcheck?a=add', + header: { + 'content-type': 'application/json', // 默认值 + 'Cookie': wx.getStorageSync("sessionid"), + }, + method: 'POST', + data: data, + success: res => { + if (res.statusCode === 200) { + wx.navigateBack({ + }) + } + wx.hideLoading(); + } + }); + }, +}) \ No newline at end of file diff --git a/pages/riskact/check.json b/pages/riskact/check.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/riskact/check.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/riskact/check.wxml b/pages/riskact/check.wxml new file mode 100644 index 0000000..2359d6f --- /dev/null +++ b/pages/riskact/check.wxml @@ -0,0 +1,51 @@ + 共{{total}}条风险 + + + + + + 低风险 + 一般风险 + 较大风险 + 重大风险 + {{item.step}} + + + 标准/危害因素 + {{item.hazard}} + + + 工程技术 + {{item.measure1}} + + + + 管理措施 + {{item.measure2}} + + + + 培训教育 + {{item.measure3}} + + + + 个体防护 + {{item.measure4}} + + + + 应急处理 + {{item.measure5}} + + + + {{item.yhnum}} + + + + + + + diff --git a/pages/riskact/check.wxss b/pages/riskact/check.wxss new file mode 100644 index 0000000..ef15154 --- /dev/null +++ b/pages/riskact/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/riskact/detail.js b/pages/riskact/detail.js new file mode 100644 index 0000000..6c6bc30 --- /dev/null +++ b/pages/riskact/detail.js @@ -0,0 +1,101 @@ +// pages/inspect/detail.js +var util = require('../../utils/util.js') +Page({ + + /** + * 页面的初始数据 + */ + data: { + fromWx:false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var riskactid + if (options.id) { + riskactid = options.id + } else { + let q = decodeURIComponent(options.q) + if (q) { + // console.log("index 生命周期 onload url=" + q) + // console.log("index 生命周期 onload 参数 trainid=" + util.getQueryString(q, 'trainid')) + riskactid = util.getQueryString(q, 'id') + this.setData({ + fromWx: true + }) + } + } + wx.showLoading({ + title: '', + }) + wx.request({ + url: getApp().globalData.serverUrl + 'api/riskact?a=detail&id=' + riskactid, + header: { + 'content-type': 'application/json', // + 'Cookie': wx.getStorageSync("sessionid"), + }, + method: 'GET', + success: res => { + if (res.statusCode === 200) { + wx.hideLoading() + this.setData(res.data.data) + } + } + }) + }, +check:function(){ +wx.redirectTo({ + url: 'check?riskact='+this.data.id, +}) +}, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/riskact/detail.json b/pages/riskact/detail.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/riskact/detail.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/riskact/detail.wxml b/pages/riskact/detail.wxml new file mode 100644 index 0000000..adea0e0 --- /dev/null +++ b/pages/riskact/detail.wxml @@ -0,0 +1,33 @@ +风险点信息 + + + 名称 + {{name}} + + + 类别 + {{type__dickeyname}} + + + 所属区域 + {{area__name}} + + + 位置 + {{place}} + + + 风险数量 + {{num}} + + + 风险等级 + 低风险 + 一般风险 + 较大风险 + 重大风险 + + + + + \ No newline at end of file diff --git a/pages/riskact/detail.wxss b/pages/riskact/detail.wxss new file mode 100644 index 0000000..3ba03f6 --- /dev/null +++ b/pages/riskact/detail.wxss @@ -0,0 +1 @@ +/* pages/riskact/detail.wxss */ \ No newline at end of file diff --git a/pages/riskact/index.js b/pages/riskact/index.js new file mode 100644 index 0000000..a5a18e2 --- /dev/null +++ b/pages/riskact/index.js @@ -0,0 +1,215 @@ +// pages/miss/miss.js +var sliderWidth = 96; +Page({ + + /** + * 页面的初始数据 + */ + data: { + page: 1, + serverUrl: getApp().globalData.serverUrl, + riskactlist: [], + tabs: ["我的记录", "全厂风险"], + activeIndex: 0, + 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.getmyriskchecklist(1) + that.data.mypage = 1 + } + else if (that.data.activeIndex == 1) { + that.getriskactlist(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 () { + this.onPullDownRefresh() + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + var that = this; + if (that.data.activeIndex == 0) { + that.getmyriskchecklist(1) + that.data.mypage = 1 + } else if (that.data.activeIndex == 1){ + that.getriskactlist(1); + this.data.page = 1; + } + wx.stopPullDownRefresh(); + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + //上拉分页,将页码加1,然后调用分页函数 + if (that.data.activeIndex == 0) { + this.data.mypage = this.data.mypage + 1; + this.getmyriskchecklist(); + } else if (that.data.activeIndex == 1){ + this.data.page = this.data.page + 1; + this.getriskactlist(); + } + wx.stopPullDownRefresh(); + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + scan: function () { + wx.scanCode({ + onlyFromCamera: true, + success(res) { + console.log(res) + let id = res.result.split('=')[1] + wx.navigateTo({ + url: 'detail?id='+id, + }) + } + }) + }, + getriskactlist: function (page) { + var that = this; + if (page != 1) { page = that.data.page } + wx.showLoading({ + title: '加载中', + }), + wx.request({ + url: this.data.serverUrl + 'api/riskact?a=listall&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, + riskactlist: [] + }) + } + else { + wx.showModal({ + content: "已经到底啦!", + showCancel: false, + confirmText: "确定", + }) + } + } else { + let list + if (page == 1) { + list = res.data.rows + } else { + list = this.data.riskactlist.concat(res.data.rows) + } + this.setData({ + total: res.data.total, + riskactlist: list + }) + } + } + wx.hideLoading(); + } + }); + }, + getmyriskchecklist: function (page) { + var that = this; + if (page != 1) { page = that.data.mapage } + wx.showLoading({ + title: '加载中', + }), + wx.request({ + url: this.data.serverUrl + 'api/riskcheck?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({ + mytotal: 0, + riskchecklist: [] + }) + } + else { + wx.showModal({ + content: "已经到底啦!", + showCancel: false, + confirmText: "确定", + }) + } + } else { + let list + if (page == 1) { + list = res.data.rows + } else { + list = this.data.riskchecklist.concat(res.data.rows) + } + this.setData({ + mytotal: res.data.total, + riskchecklist: list + }) + } + } + wx.hideLoading(); + } + }); + }, +}) \ No newline at end of file diff --git a/pages/riskact/index.json b/pages/riskact/index.json new file mode 100644 index 0000000..7efa756 --- /dev/null +++ b/pages/riskact/index.json @@ -0,0 +1,5 @@ +{ + "navigationBarTitleText": "风险点", + "enablePullDownRefresh": true, + "onReachBottomDistance": 50 +} \ No newline at end of file diff --git a/pages/riskact/index.wxml b/pages/riskact/index.wxml new file mode 100644 index 0000000..af5d0c7 --- /dev/null +++ b/pages/riskact/index.wxml @@ -0,0 +1,78 @@ + + + + + {{item}} + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/riskact/index.wxss b/pages/riskact/index.wxss new file mode 100644 index 0000000..ef15154 --- /dev/null +++ b/pages/riskact/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 diff --git a/pages/risktask/index.js b/pages/risktask/index.js index 3d32918..89ad83c 100644 --- a/pages/risktask/index.js +++ b/pages/risktask/index.js @@ -190,7 +190,7 @@ Page({ title: '加载中', }), wx.request({ - url: this.data.serverUrl + 'api/listtask?a=list2done&rows=10&page=' + page, + url: this.data.serverUrl + 'api/risktask?a=list2done&rows=10&page=' + page, header: { 'content-type': 'application/json', // 默认值 'Cookie': wx.getStorageSync("sessionid"), diff --git a/pages/risktask/index.wxml b/pages/risktask/index.wxml index 557b144..7199bc5 100644 --- a/pages/risktask/index.wxml +++ b/pages/risktask/index.wxml @@ -9,7 +9,7 @@ @@ -48,7 +49,7 @@ 排查岗位 - {{item.risk__gkcj}} {{item.risk__group__groupname}} + {{item.risk__group__groupname}} 任务生成时间:{{item.taskadd}} 任务过期时间:{{item.taskexpire}} @@ -59,6 +60,10 @@ 较大风险 重大风险 已完成 + + 风险数量 + {{item.num}} + @@ -76,7 +81,7 @@ 排查岗位 - {{item.risk__gkcj}} {{item.risk__group__groupname}} + {{item.risk__group__groupname}} 任务生成时间:{{item.taskadd}} 任务过期时间:{{item.taskexpire}} @@ -96,6 +101,6 @@ -