fxgk
This commit is contained in:
parent
1ef73b7e98
commit
83573295b9
3
app.json
3
app.json
|
@ -63,7 +63,8 @@
|
|||
"pages/risk/myindex",
|
||||
"pages/risk/detail",
|
||||
"pages/risktask/index",
|
||||
"pages/risktask/check"
|
||||
"pages/risktask/check",
|
||||
"pages/risktask/main"
|
||||
],
|
||||
"window": {
|
||||
"backgroundTextStyle": "light",
|
||||
|
|
|
@ -17,10 +17,12 @@ Page({
|
|||
console.log(options)
|
||||
this.data.riskact = options.riskact
|
||||
this.data.group = options.group
|
||||
this.getlist()
|
||||
},
|
||||
getlist:function(){
|
||||
var page = this.data.page
|
||||
wx.showLoading({
|
||||
title: '加载中',
|
||||
})
|
||||
wx.request({
|
||||
url: getApp().globalData.serverUrl + 'api/risktask?a=listtask&rows=10&page=' + page + '&group=' + this.data.group + '&riskact=' + this.data.riskact,
|
||||
header: {
|
||||
|
@ -29,6 +31,7 @@ Page({
|
|||
},
|
||||
success: res => {
|
||||
if (res.statusCode === 200) {
|
||||
wx.hideLoading()
|
||||
console.log(res.data)
|
||||
if (res.data.rows.length == 0) {
|
||||
if (page == 1) {
|
||||
|
@ -72,7 +75,7 @@ Page({
|
|||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
this.getlist()
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -108,5 +111,11 @@ Page({
|
|||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
},
|
||||
open: function (e) {
|
||||
console.log(e)
|
||||
wx.navigateTo({
|
||||
url: '/pages/trouble/addtrouble?type=risktask&index=' + e.currentTarget.dataset.index,
|
||||
})
|
||||
},
|
||||
})
|
|
@ -39,9 +39,11 @@
|
|||
<span wx:if="{{item.risk__measure5!=null}}">{{item.risk__measure5}}</span>
|
||||
<span wx:else>无</span>
|
||||
</view>
|
||||
<checkbox checked="{{item.checked}}"/>确认已排查
|
||||
<button class="weui-btn mini-btn" type="warn" size="mini" >发现隐患</button>
|
||||
<button class="weui-btn mini-btn" type="warn" size="mini" disabled="{{item.trouble__yhnum != null}}" data-index="{{index}}" bindtap="open">发现隐患</button>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view class="btn-area">
|
||||
<button class="weui-btn" type="primary" bindtap="submit" >排查完毕,提交!</button>
|
||||
</view>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</view>
|
||||
<view class="weui-tab__panel">
|
||||
<view class="weui-tab__content" hidden="{{activeIndex != 0}}">
|
||||
<view class="head">共{{donetotal}}条合理化建议</view>
|
||||
<view class="head">共{{donetotal}}条已查</view>
|
||||
<view class="weui-cells weui-cells_after-title">
|
||||
<block wx:for="{{donelist}}" wx:key="unique">
|
||||
<navigator url="detail?jyid={{item.jyid}}" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
|
||||
|
|
|
@ -0,0 +1,283 @@
|
|||
// pages/examtest/main.js
|
||||
var util = require('../../utils/util.js')
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
fxIndex: 0,
|
||||
answerChoices: [],
|
||||
ydtm: 0
|
||||
},
|
||||
riskdata: {
|
||||
|
||||
},
|
||||
calydtm: function (e) {
|
||||
var tms = this.riskdata.tms
|
||||
var ydtm = 0
|
||||
for (var i = 0, len = tms.length; i < len; ++i) {
|
||||
if (tms[i].userchecked && tms[i].userchecked.length != 0) {
|
||||
ydtm += 1
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
ydtm: ydtm
|
||||
})
|
||||
},
|
||||
radioChange: function (e) {
|
||||
console.log('radio发生change事件,携带value值为:', e.detail.value);
|
||||
var answerChoices = this.data.answerChoices;
|
||||
for (var i = 0, len = answerChoices.length; i < len; ++i) {
|
||||
answerChoices[i].checked = answerChoices[i].value == e.detail.value;
|
||||
}
|
||||
|
||||
this.setData({
|
||||
answerChoices: answerChoices,
|
||||
});
|
||||
this.riskdata.tms[this.data.fxIndex]['userchecked'] = e.detail.value
|
||||
this.calydtm()
|
||||
},
|
||||
checkboxChange: function (e) {
|
||||
console.log('checkbox发生change事件,携带value值为:', e.detail.value);
|
||||
|
||||
var answerChoices = this.data.answerChoices, values = e.detail.value;
|
||||
for (var i = 0, lenI = answerChoices.length; i < lenI; ++i) {
|
||||
answerChoices[i].checked = false;
|
||||
|
||||
for (var j = 0, lenJ = values.length; j < lenJ; ++j) {
|
||||
if (answerChoices[i].value == values[j]) {
|
||||
answerChoices[i].checked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.setData({
|
||||
answerChoices: answerChoices,
|
||||
});
|
||||
this.riskdata.tms[this.data.fxIndex]['userchecked'] = e.detail.value
|
||||
this.calydtm()
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
console.log(options)
|
||||
this.data.riskact = options.riskact
|
||||
this.data.group = options.group
|
||||
wx.showLoading({})
|
||||
wx.request({
|
||||
url: getApp().globalData.serverUrl + 'api/risktask?a=listtaskall' + '&group=' + this.data.group + '&riskact=' + this.data.riskact,
|
||||
header: {
|
||||
'content-type': 'application/json', // 默认值
|
||||
'Cookie': wx.getStorageSync("sessionid"),
|
||||
},
|
||||
success: res => {
|
||||
if (res.statusCode === 200) {
|
||||
let risks = res.data
|
||||
this.riskdata = risks
|
||||
this.showRisk(0)
|
||||
this.setData({
|
||||
total: risks.total,
|
||||
})
|
||||
}
|
||||
wx.hideLoading();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
// wx.showModal({
|
||||
// title: '系统提示',
|
||||
// content: '未完成答卷,是否要提交答卷!',
|
||||
// confirmText: "提交",
|
||||
// cancelText: "点错了",
|
||||
// success: function (res) {
|
||||
// if (res.confirm) {
|
||||
// } else {
|
||||
// this.onShow()
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
},
|
||||
showRisk: function (index) {
|
||||
var that = this
|
||||
var currentFx = that.riskdata.rows[index]
|
||||
console.log(currentFx)
|
||||
that.setData({ 'currentFx': currentFx })
|
||||
},
|
||||
showChecked: function (index) {
|
||||
var tm = this.riskdata.tms[index]
|
||||
let choices = this.data.answerChoices
|
||||
if (tm.userchecked) {
|
||||
if (tm.question__type == 2) {
|
||||
for (var i = 0, len = choices.length; i < len; i++) {
|
||||
if (tm.userchecked.indexOf(choices[i].value) != -1) {
|
||||
choices[i].checked = true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (var i = 0, len = choices.length; i < len; i++) {
|
||||
if (choices[i].value == tm.userchecked) {
|
||||
choices[i].checked = true
|
||||
}
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
answerChoices: choices
|
||||
})
|
||||
}
|
||||
},
|
||||
next: function () {
|
||||
var that = this
|
||||
var fxIndex = that.data.fxIndex + 1
|
||||
that.showTm(fxIndex)
|
||||
that.setData({
|
||||
fxIndex: fxIndex,
|
||||
})
|
||||
that.showChecked(fxIndex)
|
||||
},
|
||||
previous: function () {
|
||||
var that = this
|
||||
var fxIndex = that.data.fxIndex - 1
|
||||
that.showTm(fxIndex)
|
||||
that.setData({
|
||||
fxIndex: fxIndex,
|
||||
})
|
||||
that.showChecked(fxIndex)
|
||||
},
|
||||
hand: function () {
|
||||
var that = this
|
||||
if (that.data.ydtm < that.riskdata.tms.length) {
|
||||
wx.showModal({
|
||||
title: '警告',
|
||||
content: '答卷未完成,确定提交?',
|
||||
confirmText: "确定",
|
||||
cancelText: "取消",
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
that.handtest()
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
wx.showModal({
|
||||
content: '确定提交?',
|
||||
confirmText: "确定",
|
||||
cancelText: "取消",
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
that.handtest()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
handtest: function () {
|
||||
var data = {
|
||||
'testid': this.data.testid,
|
||||
'starttime': this.data.starttime,
|
||||
'endtime': util.formatTime(new Date()),
|
||||
'sheet': this.riskdata.tms
|
||||
}
|
||||
wx.showLoading({
|
||||
title: '自动判卷中..',
|
||||
})
|
||||
wx.request({
|
||||
url: getApp().globalData.serverUrl + 'api/examtestdetail?a=handtest&id=' + this.data.testid,
|
||||
header: {
|
||||
'content-type': 'application/json', // 默认值
|
||||
'Cookie': wx.getStorageSync("sessionid"),
|
||||
},
|
||||
method: 'POST',
|
||||
data: data,
|
||||
success: res => {
|
||||
if (res.statusCode === 200) {
|
||||
wx.hideLoading()
|
||||
wx.redirectTo({
|
||||
url: 'result?' + parseParams(res.data.data),
|
||||
})
|
||||
clearTimeout(getApp().globalData.timepass)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
function formatmil(mil) {
|
||||
var allSecond = Math.floor(mil / 1000);
|
||||
var h = Math.floor(allSecond / 3600);
|
||||
var m = Math.floor((allSecond - h * 3600) / 60);
|
||||
var s = Math.floor(allSecond - h * 3600 - m * 60);
|
||||
h = toTow(h);
|
||||
m = toTow(m);
|
||||
s = toTow(s);
|
||||
return h + ":" + m + ":" + s;
|
||||
}
|
||||
function toTow(num) {
|
||||
if (num < 10) {
|
||||
return "0" + num;
|
||||
} else {
|
||||
return num;
|
||||
}
|
||||
}
|
||||
function parseParams(data) {
|
||||
try {
|
||||
var tempArr = [];
|
||||
for (var i in data) {
|
||||
var key = encodeURIComponent(i);
|
||||
var value = encodeURIComponent(data[i]);
|
||||
tempArr.push(key + '=' + value);
|
||||
}
|
||||
var urlParamsStr = tempArr.join('&');
|
||||
return urlParamsStr;
|
||||
} catch (err) {
|
||||
return '';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "考试中"
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
<!--pages/examtest/main.wxml-->
|
||||
<view class="head">
|
||||
|
||||
<view style="float:left">倒计时 {{countdown}}</view>
|
||||
<navigator url="sheet" >
|
||||
<view class="sheet">答题卡: {{ydtm}}/{{tmtotal}}</view>
|
||||
</navigator>
|
||||
</view>
|
||||
<view >
|
||||
</view>
|
||||
<view class="weui-article">
|
||||
<view class="weui-article__h2">{{tmIndex+1}}.
|
||||
<span wx:if="{{currentTm.question__type==1}}" class="txlabel">单选题</span>
|
||||
<span wx:if="{{currentTm.question__type==2}}" class="txlabel">多选题</span>
|
||||
<span wx:if="{{currentTm.question__type==3}}" class="txlabel">判断题</span>
|
||||
<span> ({{currentTm.score}}分)</span>
|
||||
</view>
|
||||
<view class="weui-article__title">{{currentTm.question__title}}</view>
|
||||
</view>
|
||||
<radio-group bindchange="radioChange" wx:if="{{(currentTm.question__type==1 ||currentTm.question__type==3)}}">
|
||||
<label class="weui-cell weui-check__label" wx:for="{{answerChoices}}" wx:key="value">
|
||||
<radio class="weui-check" value="{{item.value}}" checked="{{item.checked}}" />
|
||||
|
||||
<view class="weui-cell__bd">{{item.name}}: {{currentTm.question__answer[item.value]}}</view>
|
||||
<view class="weui-cell__ft weui-cell__ft_in-radio" wx:if="{{item.checked}}">
|
||||
<icon class="weui-icon-radio" type="success_no_circle" size="16"></icon>
|
||||
</view>
|
||||
</label>
|
||||
</radio-group>
|
||||
<checkbox-group bindchange="checkboxChange" wx:if="{{currentTm.question__type==2}}">
|
||||
<label class="weui-cell weui-check__label" wx:for="{{answerChoices}}" wx:key="value">
|
||||
<checkbox class="weui-check" value="{{item.value}}" checked="{{item.checked}}" />
|
||||
<view class="weui-cell__bd">{{item.name}}: {{currentTm.question__answer[item.value]}}</view>
|
||||
<view class="weui-cell__hd weui-check__hd_in-checkbox">
|
||||
<icon class="weui-icon-checkbox_circle" type="circle" size="23" wx:if="{{!item.checked}}"></icon>
|
||||
<icon class="weui-icon-checkbox_success" type="success" size="23" wx:if="{{item.checked}}"></icon>
|
||||
</view>
|
||||
</label>
|
||||
</checkbox-group>
|
||||
<view style="position:fixed;bottom:0;left:0;width:100%;">
|
||||
<view style="width:30%;float:left">
|
||||
<button class="weui-btn" type="primary" bindtap="previous" disabled="{{tmIndex==0}}">上一题</button>
|
||||
</view>
|
||||
<view style="width:30%;float:left">
|
||||
<button class="weui-btn" type="primary" bindtap="next" disabled="{{tmIndex==tmtotal-1}}">下一题</button>
|
||||
</view>
|
||||
<view style="width:30%;float:right">
|
||||
<button class="weui-btn" type="primary" bindtap="hand" >交卷</button>
|
||||
</view>
|
||||
</view>
|
|
@ -0,0 +1,18 @@
|
|||
.head{
|
||||
color:#fff;
|
||||
background-color: cornflowerblue;
|
||||
}
|
||||
.txlabel{
|
||||
color:#fff;
|
||||
background-color: rgb(216, 140, 0);
|
||||
padding: 2px
|
||||
}
|
||||
.weui-btn{
|
||||
width:auto;
|
||||
margin: 5px;
|
||||
}
|
||||
.sheet{
|
||||
color:#fff;
|
||||
background-color: red;
|
||||
float:right
|
||||
}
|
|
@ -258,7 +258,30 @@ Page({
|
|||
}
|
||||
}
|
||||
});
|
||||
}else if (this.data.yhtype == 'risktask') {
|
||||
let data = {}
|
||||
data.risktask = this.data.risktaskdata.id
|
||||
data.trouble = res.data.trouble
|
||||
wx.request({
|
||||
url: this.data.serverUrl + 'api/risktask?a=checktrouble',
|
||||
header: {
|
||||
'content-type': 'application/json', //
|
||||
'Cookie': wx.getStorageSync("sessionid"),
|
||||
},
|
||||
method: 'POST',
|
||||
data: data,
|
||||
success: res => {
|
||||
if (res.statusCode === 200) {
|
||||
wx.hideLoading();
|
||||
wx.navigateBack({
|
||||
delta: 2
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
console.log(x)
|
||||
wx.hideLoading();
|
||||
wx.navigateBack()
|
||||
}
|
||||
|
@ -329,7 +352,6 @@ Page({
|
|||
mapright: false
|
||||
})
|
||||
}
|
||||
console.log(options.type)
|
||||
if(options.type=='inspect'){
|
||||
var pages = getCurrentPages();
|
||||
var prevPage = pages[pages.length - 2];
|
||||
|
@ -344,6 +366,20 @@ Page({
|
|||
equipmentname: inspectdata.equipment.name,
|
||||
})
|
||||
}
|
||||
else if (options.type == 'risktask'){
|
||||
var pages = getCurrentPages();
|
||||
var prevPage = pages[pages.length - 2];
|
||||
var risktaskdata = prevPage.data.alllist[options.index]
|
||||
console.log(risktaskdata)
|
||||
this.data.risktaskdata = risktaskdata
|
||||
this.setData({
|
||||
yhtype: 'risktask',
|
||||
yhqy: risktaskdata.risk__riskact__area__id,
|
||||
yhqy__name: risktaskdata.risk__riskact__area__name,
|
||||
yhdd: risktaskdata.risk__riskact__place,
|
||||
riskstep: risktaskdata.risk__step,
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<view class="page__bd">
|
||||
<view class="weui-toptips weui-toptips_warn" wx:if="{{showTopTips}}">错误提示</view>
|
||||
<view class="head" wx:if="{{yhtype=='inspect'}}">{{equipmentname}} 设备异常</view>
|
||||
<view class="head" wx:if="{{yhtype=='risktask'}}">风险 {{riskstep}}</view>
|
||||
<view class="weui-cells__title">隐患图片</view>
|
||||
<view class="weui-cells weui-cells_after-title">
|
||||
<view class="weui-cell">
|
||||
|
|
Loading…
Reference in New Issue