From 33f80e04110207b7bfab754255e845515863ccde Mon Sep 17 00:00:00 2001 From: caoqianming Date: Sat, 27 Jun 2020 21:57:33 +0800 Subject: [PATCH] inspect --- app.js | 2 +- app.json | 7 +- pages/checkjob/yanshou.js | 9 +- pages/data/index.wxml | 1 - pages/images/abnormal.png | Bin 0 -> 1010 bytes pages/images/abnormal.svg | 1 + pages/index/index.wxml | 34 ++++++- pages/inspect/add.js | 177 ++++++++++++++++++++++++++++++-- pages/inspect/add.wxml | 104 ++++++++++++++----- pages/inspect/add.wxss | 11 +- pages/inspect/detail.js | 15 +++ pages/inspect/detail.wxml | 25 +++-- pages/inspect/detail2.js | 90 ++++++++++++++++ pages/inspect/detail2.json | 3 + pages/inspect/detail2.wxml | 85 ++++++++++++++++ pages/inspect/detail2.wxss | 1 + pages/inspect/handle.js | 178 ++++++++++++++++++++++++++++++++ pages/inspect/handle.json | 3 + pages/inspect/handle.wxml | 80 +++++++++++++++ pages/inspect/handle.wxss | 4 + pages/inspect/index.js | 101 ++++++++++++++++-- pages/inspect/index.wxml | 55 ++++++++-- pages/inspect/index2.js | 204 +++++++++++++++++++++++++++++++++++++ pages/inspect/index2.json | 5 + pages/inspect/index2.wxml | 67 ++++++++++++ pages/inspect/index2.wxss | 14 +++ pages/main/main.js | 22 ++++ pages/main/main.wxml | 32 ++++-- pages/operins/index.js | 195 +++++++++++++++++++++++++++++++++++ pages/operins/index.json | 4 + pages/operins/index.wxml | 39 +++++++ pages/operins/index.wxss | 31 ++++++ 32 files changed, 1517 insertions(+), 82 deletions(-) create mode 100644 pages/images/abnormal.png create mode 100644 pages/images/abnormal.svg create mode 100644 pages/inspect/detail2.js create mode 100644 pages/inspect/detail2.json create mode 100644 pages/inspect/detail2.wxml create mode 100644 pages/inspect/detail2.wxss create mode 100644 pages/inspect/handle.js create mode 100644 pages/inspect/handle.json create mode 100644 pages/inspect/handle.wxml create mode 100644 pages/inspect/handle.wxss create mode 100644 pages/inspect/index2.js create mode 100644 pages/inspect/index2.json create mode 100644 pages/inspect/index2.wxml create mode 100644 pages/inspect/index2.wxss create mode 100644 pages/operins/index.js create mode 100644 pages/operins/index.json create mode 100644 pages/operins/index.wxml create mode 100644 pages/operins/index.wxss diff --git a/app.js b/app.js index cfbf7c9..d24175a 100644 --- a/app.js +++ b/app.js @@ -98,7 +98,7 @@ App({ openid:null }, serverUrl: 'https://safeyun.ctcshe.com/', - // serverUrl: 'http://127.0.0.1:8000/', + //serverUrl: 'http://127.0.0.1:8000/', //serverUrl: 'http://10.21.28.148:8000/', //serverUrl: 'http://192.168.0.103:8000/', //serverUrl:'http://10.0.11.195:8000/', diff --git a/app.json b/app.json index 93b8de8..7ec4d0f 100644 --- a/app.json +++ b/app.json @@ -78,9 +78,12 @@ "pages/totalrate/index", "pages/checkjob/yanshou", "pages/checkjob/job", - "pages/checkjob/detail", - "pages/checkjob/index" + "pages/checkjob/index", + "pages/operins/index", + "pages/inspect/index2", + "pages/inspect/detail2", + "pages/inspect/handle" ], "window": { "backgroundTextStyle": "light", diff --git a/pages/checkjob/yanshou.js b/pages/checkjob/yanshou.js index 3187785..fed9169 100644 --- a/pages/checkjob/yanshou.js +++ b/pages/checkjob/yanshou.js @@ -112,12 +112,17 @@ Page({ if (res.statusCode === 200) { var yhdata = res.data //格式化隐患信息 + if(yhdata.yhtp){ for (var i = 0; i < yhdata.yhtp.length; i++) { yhdata.yhtp[i] = this.data.serverUrl + yhdata.yhtp[i]; } - for (var i = 0; i < yhdata.zghtp.length; i++) { - yhdata.zghtp[i] = this.data.serverUrl + yhdata.zghtp[i]; } + if(yhdata.zghtp){ + for (var i = 0; i < yhdata.zghtp.length; i++) { + yhdata.zghtp[i] = this.data.serverUrl + yhdata.zghtp[i]; + } + } + this.setData(yhdata) } diff --git a/pages/data/index.wxml b/pages/data/index.wxml index 25ad143..4f05dc0 100644 --- a/pages/data/index.wxml +++ b/pages/data/index.wxml @@ -35,7 +35,6 @@ {{item.title}} {{item.user__ubelongpart__partname}} {{item.user__name}}分享 类别:{{item.cate__name}} - 最新编辑:{{item.modifytime}} diff --git a/pages/images/abnormal.png b/pages/images/abnormal.png new file mode 100644 index 0000000000000000000000000000000000000000..4b6eb70011e69c7f1dbb52bcd013e374b1ffd46e GIT binary patch literal 1010 zcmV%KY4Z+`Rpe&+X^dBgrB$nimP zTt5N;K?VS*z0+QuI7D%-!HCC3V?s&vQonCi!3c3a;GMG#<+U3ZQrQ*SQApEw4BLASMGkJAtVwV0G17MO9P)O-;ba zh&MmU*7po*rOj#a-}~mB8R2P+ksgGyom{*zu%dk6V`kI(14qpPY1ZU$sokz_JWsXCcd=vwEg5H z^W}2z1u!(k>Q!%SZLxBgpEnP^u8yUBNr}E4Jy*KBUCIae0-#};LD=4AyEiwdFQC4j z?R-%Y7xC07e*jhxc6Jzq+1cYF8ycAS!a{E1#R0H_u)E93VP=MjZER#|Ur@kRyjTEM z5cc;|hZ)`Z{Cw`>#RIT{kVr7mk|acYW&l`0FgnjYp7us=#T z5d=4%w?+q}$FqPh06hq9#2aOTNAcp`0$L_`5q}bb58}lE&@#cVM-2t)lP~@y!08p| zm)ih9@awR}&*N?zBuJKY+-;IPMWc51U*7QmsnbxoT{p?;<3?}*_6UgW0gbg zAwo!0n|G`P0suhFxa?Y$&55e2 z#()bSQr g1oIhQB \ No newline at end of file diff --git a/pages/index/index.wxml b/pages/index/index.wxml index be2d3f9..7ead072 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -58,15 +58,41 @@ + + + + + + + + 操作规程 + + + + + + - - 点击下载系统/小程序文档介绍 - Copyright © 2018-2020 国检集团 - 中存大数据提供技术支持 + 点击下载系统/小程序文档介绍 + Copyright © 2018-2020 国检集团 + 中存大数据提供技术支持 \ No newline at end of file diff --git a/pages/inspect/add.js b/pages/inspect/add.js index 7f14aa7..4a74a80 100644 --- a/pages/inspect/add.js +++ b/pages/inspect/add.js @@ -5,10 +5,14 @@ Page({ * 页面的初始数据 */ data: { + items: [ + { name: '正常', value: '正常' }, + { name: '异常', value: '异常' }, + ], serverUrl: getApp().globalData.serverUrl, state:1, - selected:true, -         selected1:false + selected:false, +         selected1:true         },     selected:function(e){         this.setData({ @@ -32,6 +36,25 @@ Page({ state: e.detail.value, }); }, + bindjclxChange: function (e) { + this.setData({ + jclxIndex: e.detail.value, + }) + this.data.jclx = this.data.jclxArray[e.detail.value].value + }, + radioChange2: function (e) { + var that = this + that.data.itemscheck[e.currentTarget.dataset.index].checked = true + if (e.detail.value=='正常'){ + that.data.itemscheck[e.currentTarget.dataset.index].state = '正常' + } + else if (e.detail.value == '异常'){ + that.data.itemscheck[e.currentTarget.dataset.index].state = '异常待处理' + } + that.setData({ + itemscheck:that.data.itemscheck + }) + }, bindcontentInput: function (e) { this.data.content = e.detail.value }, @@ -50,18 +73,16 @@ Page({ equipment:res.data }) wx.request({ - url: this.data.serverUrl + 'api/equipmentcheckform/'+id, + url: this.data.serverUrl + 'api/equipmentcheckform/'+res.data.checkform, header: { 'content-type': 'application/json', // 默认值 'Cookie': getApp().globalData.sessionId, }, success: res => { if (res.statusCode === 200) { - this.setData({ - itemscheck:res.items + itemscheck:res.data.items }) - } wx.hideLoading(); } @@ -88,6 +109,25 @@ Page({ } } }); + //获取巡检类型 + wx.request({ + url: this.data.serverUrl + 'getdickey?dicclass=57&a=combobox', + header: { + 'content-type': 'application/json', // 默认值 + 'Cookie': getApp().globalData.sessionId, + }, + data: {}, + success: res => { + if (res.statusCode === 200) { + this.data.jclxArray = res.data; + this.setData({ + jclxArray: res.data, + jclxIndex: 0, + jclx: res.data[0].value//默认检查类型 + }) + } + } + }); }, submit:function(){ let data={ @@ -122,6 +162,8 @@ submit:function(){ url: '/pages/trouble/addtrouble?type=inspect', }) }, + + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -169,5 +211,126 @@ submit:function(){ */ onShareAppMessage: function () { - } + }, + chooseImage: function (e) { + var that = this + wx.chooseImage({ + count: 1, + sizeType: ['original', 'compressed'], + sourceType: ['album', 'camera'], + success: function (res) { + wx.showLoading({ + title: '上传图片..', + mask:true + }) + wx.uploadFile({ + header: { + 'content-type': 'application/json', // 默认值 + 'Cookie': getApp().globalData.sessionId, + }, + url: getApp().globalData.serverUrl + 'upfile', + filePath: res.tempFilePaths[0], + name: 'upfile', + success(res) { + wx.hideLoading() + var obj = JSON.parse(res.data); + that.data.itemscheck[e.currentTarget.dataset.index].img = getApp().globalData.serverUrl + obj['filepath'] + that.setData({ + itemscheck:that.data.itemscheck + }) + + }, + complete: function (res) { + wx.hideLoading() + } + }) + } + }) + }, + previewImage: function (e) { + console.log(e) + var current = e.target.dataset.src + wx.previewImage({ + current: current, + urls: [current] + }) + }, + deleteImage: function (e) { + var that = this; + var index = e.currentTarget.dataset.index; //获取当前长按图片下标 + wx.showModal({ + title: '系统提醒', + content: '确定要删除此图片吗?', + success: function (res) { + if (res.confirm) { + that.data.itemscheck[index].img = null + } else if (res.cancel) { + return false + } + that.setData({ + itemscheck: that.data.itemscheck + }); + } + }) + }, + descChange: function(e){ + var that = this + that.data.itemscheck[e.currentTarget.dataset.index].desc=e.detail.value + }, + submit3: function () { + var that = this + let data1 = { + equipment: this.data.equipment.id, + state: 1, + type: this.data.jclx + } + let data2 = that.data.itemscheck + for(var i=0;i { + if (res.statusCode === 200) { + wx.request({ + url: getApp().globalData.serverUrl + 'api/inspectitem?a=adds', + header: { + 'content-type': 'application/json', // 默认值 + 'Cookie': getApp().globalData.sessionId, + }, + method: 'POST', + data: { + 'inspect':res.data.inspect, + 'items':data2 + }, + success: res => { + if (res.statusCode === 200) { + wx.redirectTo({ + url: '/pages/inspect/index', + }) + } + wx.hideLoading(); + } + }); + } + wx.hideLoading(); + } + }); + }, }) \ No newline at end of file diff --git a/pages/inspect/add.wxml b/pages/inspect/add.wxml index a7236e5..e97e16c 100644 --- a/pages/inspect/add.wxml +++ b/pages/inspect/add.wxml @@ -14,38 +14,88 @@ - -    风险点项目 -    检查表项目 - - - - {{item.step}}-{{item.result}} - {{item.hazard}} - - - -for activity -巡检记录 + + 检查表 - + 安全风险 + + + + + + {{item.step}}- + {{item.result}} + + {{item.hazard}} + + + + + + + + + + 巡检类型 + + + + {{jclxArray[jclxIndex].text}} + + + + + + + {{item.name}} + + {{item.content}} + + + + + + {{item.value}} + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/inspect/add.wxss b/pages/inspect/add.wxss index 14b9f71..6d6b608 100644 --- a/pages/inspect/add.wxss +++ b/pages/inspect/add.wxss @@ -2,8 +2,9 @@ margin:5px } page{background-color:#edf0f3;} -.nav{width:100%;height:30rpx;display:flex;flex-direction:row;} -.default{line-height:100rpx;text-align:center;flex:1;border-right:1px solid gainsboro;color:#000;font-weight:bold;font-size:28rpx;} -.red{line-height:100rpx;text-align:center;color:#fc5558;flex:1;border-right:1px solid gainsboro;font-weight:bold;font-size:28rpx;} -.show{display:block;text-align:center;line-height:200rpx;} -.hidden{display:none;text-align:center;line-height:200px;} +.nav{width:100%;height:auto;display:flex;flex-direction:row;} +.default{text-align:center;flex:1;border-right:1px solid gainsboro;color:#000;font-weight:bold;font-size:28rpx;} +.red{text-align:center;color:#fc5558;flex:1;border-right:1px solid gainsboro;font-weight:bold;font-size:28rpx;} +.show{display:block;text-align:left;} +.hidden{display:none;text-align:left;} + diff --git a/pages/inspect/detail.js b/pages/inspect/detail.js index f5b0374..f7dc699 100644 --- a/pages/inspect/detail.js +++ b/pages/inspect/detail.js @@ -25,6 +25,21 @@ Page({ } } }) + wx.request({ + url: getApp().globalData.serverUrl + 'api/inspectitem?a=listall&pageoff=1&inspect=' + options.id, + header: { + 'content-type': 'application/json', // + 'Cookie': getApp().globalData.sessionId, + }, + method: 'GET', + success: res => { + if (res.statusCode === 200) { + this.setData({ + checkitems:res.data.rows + }) + } + } + }) }, /** diff --git a/pages/inspect/detail.wxml b/pages/inspect/detail.wxml index 7168852..9dc4850 100644 --- a/pages/inspect/detail.wxml +++ b/pages/inspect/detail.wxml @@ -1,10 +1,10 @@ -巡检内容 +基本信息 巡检人 {{user__name}} - + 提交时间 {{creattime}} @@ -29,8 +29,21 @@ 巡检记录 {{content}} - - 关联隐患 - {{trouble__yhnum}} - +检查表 + + + + + + {{item.state}} + {{item.state}} + {{item.checkitem__name}} + + + {{item.checkitem__content}} + + + + + \ No newline at end of file diff --git a/pages/inspect/detail2.js b/pages/inspect/detail2.js new file mode 100644 index 0000000..8654564 --- /dev/null +++ b/pages/inspect/detail2.js @@ -0,0 +1,90 @@ +// pages/inspect/detail.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + wx.request({ + url: getApp().globalData.serverUrl + 'api/inspectitem?a=detail&id=' + options.id, + header: { + 'content-type': 'application/json', // + 'Cookie': getApp().globalData.sessionId, + }, + method: 'GET', + success: res => { + if (res.statusCode === 200) { + if(res.data.img){ + res.data.img = getApp().globalData.serverUrl + res.data.img + } + if (res.data.img2) { + res.data.img2 = getApp().globalData.serverUrl + res.data.img2 + } + this.setData(res.data) + } + } + }) + }, + previewImage: function (e) { + var current = e.target.dataset.src + wx.previewImage({ + current: current, + urls: [current] + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/inspect/detail2.json b/pages/inspect/detail2.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/inspect/detail2.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/inspect/detail2.wxml b/pages/inspect/detail2.wxml new file mode 100644 index 0000000..6510d2c --- /dev/null +++ b/pages/inspect/detail2.wxml @@ -0,0 +1,85 @@ +异常信息 + + + + + 巡检信息 + + {{inspect__user__name}} + {{inspect__type__dickeyname}}巡检-{{inspect__creattime}} + + + + 设备编号 + {{inspect__equipment__num}} + + + 设备名称 + {{inspect__equipment__name}} + + + 状态 + {{state}} + + + + 异常项目 + + {{checkitem__name}} + {{checkitem__content}} + + + + + + 异常描述 + + {{desc}} + + + + + + 异常图片 + + + + + + + + + +处理信息 + + + 处理人 + {{todouser__name}} + + + + 处理描述 + + {{desc2}} + + + + + + 处理图片 + + + + + + + + + diff --git a/pages/inspect/detail2.wxss b/pages/inspect/detail2.wxss new file mode 100644 index 0000000..56a040a --- /dev/null +++ b/pages/inspect/detail2.wxss @@ -0,0 +1 @@ +/* pages/inspect/detail2.wxss */ \ No newline at end of file diff --git a/pages/inspect/handle.js b/pages/inspect/handle.js new file mode 100644 index 0000000..cd1823a --- /dev/null +++ b/pages/inspect/handle.js @@ -0,0 +1,178 @@ +// pages/inspect/detail.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + desc2:'' + }, + binddesc2Input: function (e) { + this.data.desc2 = e.detail.value + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + wx.request({ + url: getApp().globalData.serverUrl + 'api/inspectitem?a=detail&id=' + options.id, + header: { + 'content-type': 'application/json', // + 'Cookie': getApp().globalData.sessionId, + }, + method: 'GET', + success: res => { + if (res.statusCode === 200) { + if (res.data.img) { + res.data.img = getApp().globalData.serverUrl + res.data.img + } + this.setData(res.data) + } + } + }) + }, + previewImage: function (e) { + var current = e.target.dataset.src + wx.previewImage({ + current: current, + urls: [current] + }) + }, + deleteImage: function (e) { + var that = this; + //var index = e.currentTarget.dataset.index; //获取当前长按图片下标 + wx.showModal({ + title: '系统提醒', + content: '确定要删除此图片吗?', + success: function (res) { + if (res.confirm) { + that.data.img2 = null + } else if (res.cancel) { + return false + } + that.setData({ + img2: that.data.img2 + }); + } + }) + }, + chooseImage: function (e) { + var that = this + wx.chooseImage({ + count: 1, + sizeType: ['original', 'compressed'], + sourceType: ['album', 'camera'], + success: function (res) { + wx.showLoading({ + title: '上传图片..', + mask: true + }) + wx.uploadFile({ + header: { + 'content-type': 'application/json', // 默认值 + 'Cookie': getApp().globalData.sessionId, + }, + url: getApp().globalData.serverUrl + 'upfile', + filePath: res.tempFilePaths[0], + name: 'upfile', + success(res) { + wx.hideLoading() + var obj = JSON.parse(res.data); + that.data.img2 = getApp().globalData.serverUrl + obj['filepath'] + that.setData({ + img2: that.data.img2 + }) + + }, + complete: function (res) { + wx.hideLoading() + } + }) + } + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + submit: function () { + var that = this + if(that.data.desc2 == ''){ + wx.showToast({ + title: '未填写处理描述', + icon:'none' + }) + return + } + let data = { + id:that.data.id, + desc2: that.data.desc2, + img2: that.data.img2 + } + if (that.data.img2 && that.data.img2.indexOf(getApp().globalData.serverUrl) != -1) { + data.img2 = data.img2.replace(getApp().globalData.serverUrl, '') + } + wx.showLoading({ + title: '提交中', + }) + wx.request({ + url: getApp().globalData.serverUrl + 'api/inspectitem?a=handle', + header: { + 'content-type': 'application/json', // 默认值 + 'Cookie': getApp().globalData.sessionId, + }, + method: 'POST', + data: data, + success: res => { + wx.navigateBack({ + + }) + wx.hideLoading(); + } + }); + }, +}) \ No newline at end of file diff --git a/pages/inspect/handle.json b/pages/inspect/handle.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/inspect/handle.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/inspect/handle.wxml b/pages/inspect/handle.wxml new file mode 100644 index 0000000..8b5cffe --- /dev/null +++ b/pages/inspect/handle.wxml @@ -0,0 +1,80 @@ +异常信息 + + + + + 巡检信息 + + {{inspect__user__name}} + {{inspect__type__dickeyname}}巡检-{{inspect__creattime}} + + + + 设备编号 + {{inspect__equipment__num}} + + + 设备名称 + {{inspect__equipment__name}} + + + 状态 + {{state}} + + + + 异常项目 + + {{checkitem__name}} + {{checkitem__content}} + + + + + + 异常描述 + + {{desc}} + + + + + + 异常图片 + + + + + + + + +处理描述 + + + +