From 02a50195e97885b04d54fb2e92d461704b6bb050 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 17 Jul 2019 18:18:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=B7=A1=E6=A3=80=E5=92=8C?= =?UTF-8?q?=E5=B2=97=E4=BD=8D=E9=A3=8E=E9=99=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 8 ++-- pages/equipment/detail.js | 27 ++++++++++- pages/equipment/detail.wxml | 69 ++++++++++++++++++++++++++- pages/examtest/main.js | 4 +- pages/inspect/add.wxml | 2 +- pages/inspect/detail.js | 14 +++++- pages/inspect/detail.wxml | 38 ++++++++++++++- pages/inspect/index.wxml | 10 ++++ pages/main/main.js | 16 ++++++- pages/main/main.wxml | 4 +- pages/risk/detail.js | 15 +++++- pages/risk/detail.wxml | 95 ++++++++++++++++++++++++++++++++++++- pages/risk/myindex.wxml | 6 +-- pages/safecert/index.js | 3 ++ pages/socert/socert.js | 4 +- 15 files changed, 292 insertions(+), 23 deletions(-) diff --git a/app.js b/app.js index 9ae06b8..2036e08 100644 --- a/app.js +++ b/app.js @@ -55,6 +55,7 @@ App({ data: {}, success: res => { if (res.statusCode === 200) { + console.log(res.data.rights) that.globalData.rights = res.data.rights } @@ -73,11 +74,12 @@ 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 + isaqy: 0, + timepass:null //定时器 }, }) \ No newline at end of file diff --git a/pages/equipment/detail.js b/pages/equipment/detail.js index ca25901..82a6291 100644 --- a/pages/equipment/detail.js +++ b/pages/equipment/detail.js @@ -1,4 +1,5 @@ // pages/equipment/detail.js +var util = require('../../utils/util.js') Page({ /** @@ -12,7 +13,31 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + var equipmentid + if(options.id){ + equipmentid = 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')) + equipmentid = util.getQueryString(q, 'id') + } + } + wx.request({ + url: getApp().globalData.serverUrl + 'api/equipment?a=detail&id=' + equipmentid, + header: { + 'content-type': 'application/json', // 默认值 + 'Cookie': wx.getStorageSync("sessionid"), + }, + data: {}, + success: res => { + if (res.statusCode === 200) { + //console.log(res.data) + this.setData(res.data) + } + } + }); }, /** diff --git a/pages/equipment/detail.wxml b/pages/equipment/detail.wxml index 97cdd71..e4ecb82 100644 --- a/pages/equipment/detail.wxml +++ b/pages/equipment/detail.wxml @@ -1,2 +1,67 @@ - -pages/equipment/detail.wxml +基本信息 + + + 设备编号 + {{num}} + + + 设备名称 + {{name}} + + + 区域 + {{area__name}} + + + 具体位置 + {{place}} + + + 当前状态 + 正常 + 异常 + + +详细信息 + + + 设备类别 + {{cate__dickeyname}} + + + 型号 + {{type}} + + + 生产厂家 + {{oem}} + + + 出厂编号 + {{fnum}} + + + 出厂日期 + {{fdate}} + + + 投用日期 + {{udate}} + + + 责任部门 + {{zrbm__partname}} + + + 责任人 + {{zrr__name}} + + + + 主要技术参数 + + {{parameter}} + + + + \ No newline at end of file diff --git a/pages/examtest/main.js b/pages/examtest/main.js index fc0de02..94c63c7 100644 --- a/pages/examtest/main.js +++ b/pages/examtest/main.js @@ -168,7 +168,7 @@ Page({ return }; - setTimeout( + getApp().globalData.timepass=setTimeout( () => { mil -= 1000; this.begin(mil); @@ -284,7 +284,7 @@ Page({ wx.redirectTo({ url: 'result?' + parseParams(res.data.data), }) - + clearTimeout(getApp().globalData.timepass) } } }); diff --git a/pages/inspect/add.wxml b/pages/inspect/add.wxml index 1c518d9..8f209f6 100644 --- a/pages/inspect/add.wxml +++ b/pages/inspect/add.wxml @@ -4,7 +4,7 @@ 设备编号 {{equipment.num}} - + 设备名称 {{equipment.name}} diff --git a/pages/inspect/detail.js b/pages/inspect/detail.js index 2532199..8dc9ef2 100644 --- a/pages/inspect/detail.js +++ b/pages/inspect/detail.js @@ -12,7 +12,19 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + wx.request({ + url: getApp().globalData.serverUrl + 'api/inspect?a=detail&id='+options.id, + header: { + 'content-type': 'application/json', // + 'Cookie': wx.getStorageSync("sessionid"), + }, + method: 'GET', + success: res => { + if (res.statusCode === 200) { + this.setData(res.data) + } + } + }) }, /** diff --git a/pages/inspect/detail.wxml b/pages/inspect/detail.wxml index e0e1c87..7168852 100644 --- a/pages/inspect/detail.wxml +++ b/pages/inspect/detail.wxml @@ -1,2 +1,36 @@ - -pages/inspect/detail.wxml +巡检内容 + + + 巡检人 + {{user__name}} + + + 提交时间 + {{creattime}} + + + 设备编号 + {{equipment__num}} + + + 设备名称 + {{equipment__name}} + + + 区域 + {{equipment__area__name}} + + + 设备状态 + 正常 + 异常 + + + 巡检记录 + {{content}} + + + 关联隐患 + {{trouble__yhnum}} + + diff --git a/pages/inspect/index.wxml b/pages/inspect/index.wxml index d3596a1..2a60e89 100644 --- a/pages/inspect/index.wxml +++ b/pages/inspect/index.wxml @@ -9,6 +9,16 @@ 正常 异常 + + 措施/方案待提交 + 待复查 + 待评估 + 待整改 + 已归档 + 措施/方案待确认 + 待审核 + 待新增 + {{item.creattime}} diff --git a/pages/main/main.js b/pages/main/main.js index 230407f..c2709c2 100644 --- a/pages/main/main.js +++ b/pages/main/main.js @@ -255,7 +255,7 @@ Page({ }) }else{ wx.showModal({ - content: '该功能为增值服务,如需开通,请查看相关公告!', + content: '该功能如需开通,请查看公告或联系管理员!', showCancel: false }) } @@ -267,10 +267,22 @@ Page({ }) } else { wx.showModal({ - content: '该功能为增值服务,如需开通,请查看相关公告!', + content: '该功能如需开通,请查看公告或联系管理员!', showCancel:false }) } }, + tapinspect: function () { + if (getApp().globalData.rights.indexOf('35') != -1) {//设备巡检 + wx.navigateTo({ + url: '/pages/inspect/index', + }) + } else { + wx.showModal({ + content: '该功能如需开通,请查看公告或联系管理员!', + showCancel: false + }) + } + }, }) \ No newline at end of file diff --git a/pages/main/main.wxml b/pages/main/main.wxml index d5f432c..7dd753e 100644 --- a/pages/main/main.wxml +++ b/pages/main/main.wxml @@ -27,10 +27,10 @@ 作业许可 {{zytodonum}} - + 设备巡检 - + 学习园地 diff --git a/pages/risk/detail.js b/pages/risk/detail.js index 8a7128d..25302bb 100644 --- a/pages/risk/detail.js +++ b/pages/risk/detail.js @@ -12,7 +12,20 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + wx.request({ + url: getApp().globalData.serverUrl + 'api/risk?a=detail&id=' + options.id, + header: { + 'content-type': 'application/json', // 默认值 + 'Cookie': wx.getStorageSync("sessionid"), + }, + data: {}, + success: res => { + if (res.statusCode === 200) { + //console.log(res.data) + this.setData(res.data) + } + } + }) }, /** diff --git a/pages/risk/detail.wxml b/pages/risk/detail.wxml index 8f2c549..0b7f595 100644 --- a/pages/risk/detail.wxml +++ b/pages/risk/detail.wxml @@ -1,2 +1,93 @@ - -pages/risk/detail.wxml + + 风险信息 + + + + 风险类型 + + + {{riskact__type__dickeyname}} + + + + + 名称 + + + {{riskact__name}} + + + + + 所属区域 + + + {{riskact__area__name}} + + + + + 项目/步骤 + + + {{step}} + + + + + 危害因素 + + + {{hazard}} + + + + + 可能后果 + + + {{result}} + + + + +风险等级和管控措施 + + + + 重大风险 + 较大风险 + 一般风险 + 低风险 + + + LECD分析法: L:{{riskl}} + E:{{riske}} + C:{{riskc}} + D:{{riskd}} + + + + + 工程技术措施 + {{measure1}} + + + + 管理措施措施 + {{measure2}} + + + + 培训教育措施 + {{measure3}} + + + 个体防护措施 + {{measure4}} + + + 应急防护措施 + {{measure5}} + + diff --git a/pages/risk/myindex.wxml b/pages/risk/myindex.wxml index b1b88fd..4e82989 100644 --- a/pages/risk/myindex.wxml +++ b/pages/risk/myindex.wxml @@ -3,10 +3,10 @@ - 重大风险 - 较大风险 + 重大风险 + 较大风险 一般风险 - 低风险 + 低风险 -- {{item.step}} diff --git a/pages/safecert/index.js b/pages/safecert/index.js index 648fa0f..80d3f01 100644 --- a/pages/safecert/index.js +++ b/pages/safecert/index.js @@ -139,6 +139,9 @@ Page({ wx.navigateTo({ url: '../user/userdetail', }) + } else { + wx.navigateBack({ + }) } } }) diff --git a/pages/socert/socert.js b/pages/socert/socert.js index a11ff93..767fb9a 100644 --- a/pages/socert/socert.js +++ b/pages/socert/socert.js @@ -87,7 +87,6 @@ Page({ }) }else{ wx.navigateBack({ - }) } } @@ -139,6 +138,9 @@ Page({ wx.navigateTo({ url: '../user/userdetail', }) + } else { + wx.navigateBack({ + }) } } })