Browse Source

安检巡查bug

data-page-V4.3.1
mk 1 year ago
parent
commit
31cf5807cc
  1. 67
      subpages/InspectionReport/pages/InspectionReport/InspectionReport.js
  2. 27
      subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml
  3. 104
      subpages/safetyinspection/pages/safetyinspection/safetyinspection.js
  4. 92
      subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml
  5. 5
      subpages/securityCheck/pages/securityCheck.js
  6. 4
      subpages/securityCheck/pages/securityCheck.wxml
  7. 27
      utils/index.js

67
subpages/InspectionReport/pages/InspectionReport/InspectionReport.js

@ -18,7 +18,6 @@ Page({
data: {
showtime:false,
checkboxOptions:[],
checkboxOptionsnumber:0,
hiddenDangeList: [],
newObj:[],
addRecord: [],
@ -67,7 +66,8 @@ Page({
newContent:'',
currentDate: new Date().getTime(),
minDate: new Date(2020, 0, 1).getTime(),
maxDate: new Date(2030, 11, 31).getTime()
maxDate: new Date(2030, 11, 31).getTime(),
checkboxValue:[]
},
/**
* 生命周期函数--监听页面加载
@ -90,25 +90,21 @@ Page({
},
showRecordData() {
console.log(this.data.companyId)
this.setData({
checkboxOptions:null
})
let parm = {
id: this.data.companyId
}
showRecord(parm).then(res => {
console.log(res)
if(res.data[0].hiddenDangeList){
let checkboxOptions = res.data[0].hiddenDangeList.filter(item=>item.hazardStatus === 0).map(item=>({hazardDesc:item.hazardDesc,hazardStatus:0}));
let checkboxOptionsnumber=checkboxOptions.length+1;
console.log(checkboxOptionsnumber)
let checkboxOptions = res.data[0].hiddenDangeList.filter(item=>item.hazardStatus === 0).map(item=>({hazardDesc:item.hazardDesc,hazardStatus:0,id:item.id}));
this.setData({
checkboxOptions,
checkboxOptionsnumber
beforeFlag: res.data[0].checkResultFlag
})
console.log(this.data.checkboxOptions);
}
this.setData({
showList:res.data
})
console.log(this.data.showList)
})
},
getCurrentDateTime() {
@ -122,19 +118,6 @@ Page({
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
submitBiao() {
console.log("zhixingle")
console.log(this.data.newContent)
if (this.data.newContent) {
let newArr = this.data.addHiddenDangeList.concat({
hazardDesc: this.data.newContent,
hazardStatus: 0
});
console.log(newArr)
this.setData({
addHiddenDangeList: newArr,
});
}
if(!this.data.companyId){
wx.showToast({
title: '请选择企业',
@ -163,30 +146,29 @@ Page({
})
return false
}
console.log( this.data.addHiddenDangeList)
if(this.data.checkResultFlag == 0 && this.data.addHiddenDangeList.length<1){
if(this.data.checkResultFlag == 0 && this.data.checkboxValue.length<1&&!this.data.hazardDesc2){
wx.showToast({
title: '隐患明细最少输入一条',
icon:'none'
})
return false
}
const now = new Date();
const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0');
const seconds = now.getSeconds().toString().padStart(2, '0');
let checkboxOptions =this.data.addHiddenDangeList.filter(item=>item.hazardStatus === 0).map(item=>({hazardDesc:item.hazardDesc,hazardStatus:2,requirements:this.data.hazardDesc2}));
this.setData({
addHiddenDangeList:checkboxOptions
})
console.log(this.data.addHiddenDangeList)
this.data.checkboxOptions.forEach(item => {
if(this.checkboxValue.findIndex(itemC=>itemC === item.value) == -1){
item.hazardStatus = '1';
}else{
item.hazardStatus = '0';
}
})
console.log(this.data.checkboxValue);
console.log(this.data.checkboxOptions);
let form={ companyId: this.data.companyId,
checkTime: this.getCurrentDateTime(),
checkPersonsIdList: this.data.checkPersonsIdList,
checkResultFlag: this.data.checkResultFlag,
reviewTime:this.data.getData,
hiddenDangeList:this.data.checkboxOptions.concat(this.data.addHiddenDangeList),
hiddenDangeList:null,
attachmentUrls:this.data.uploadImageList.map(item=>({fileName:item.originFileName,attachmentUrl:item.ossUrl.url})),
remark: '',
reviewAddress:this.data.addressContent
@ -277,13 +259,11 @@ Page({
*/
onShareAppMessage() {},
onChange(event) {
console.log("111", event)
console.log(event);
this.setData({
result: event.detail
checkboxValue: event.detail
});
console.log(this.data.result);
console.log(this.data.hiddenDangeList);
console.log(this.data.checkboxValue);
},
afterRead(event) {
const {
@ -402,7 +382,8 @@ Page({
// 更新当前选中的索引
this.setData({
gridNName: this.data.companyList[e.detail.value].name,
companyId:this.data.companyList[e.detail.value].id
companyId:this.data.companyList[e.detail.value].id,
checkboxValue:[]
});
this.showRecordData()
},

27
subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml

@ -44,13 +44,16 @@
<view class="prosecutors">
<text class="prosecutors_req" wx:if="{{checkResultFlag == 0}}">*</text>
<view class="conclusion1">
<text class="prosecutors_pre">隐患明细</text>
<text class="prosecutors_pre">{{beforeFlag == 1?'隐患明细':'未整改隐患'}}</text>
</view>
</view>
<view class="checkbox1">
<van-checkbox-group value="{{checkboxValue}}" bind:change="onChange" wx:if="{{checkboxOptions}}" >
<van-checkbox custom-class="group" name="{{item.id}}" wx:for="{{checkboxOptions}}">{{index + 1}}. {{item.hazardDesc}}</van-checkbox>
</van-checkbox-group>
<view class="addHiddenDangeList">
<text wx:for="{{addHiddenDangeList}}" wx:for-index="index" class="addHiddenDangeListText"
wx:for-item="item">{{index+1}}.{{item.hazardDesc}}</text>
wx:for-item="item"> {{item.hazardDesc}}</text>
</view>
</view>
<view class="input1">
@ -62,21 +65,17 @@
</view> -->
</view>
<view class="pitfall">
<view class="pitfall" wx:if="{{beforeFlag == 1}}">
<view class="prosecutors">
<view class="requirement">
<text class="prosecutors_req">*</text>
<view class="conclusion1">
<text class="prosecutors_pre">整改要求</text>
</view>
</view>
<!-- <view class="checkbox1">
<van-checkbox-group value="{{ hazardDesc }}">
<van-checkbox name="hazardDesc">{{ hazardDesc }}</van-checkbox>
</van-checkbox-group>
</view> -->
<view class="input1">
<input bindinput="changeHazardDescStatus2" type="text" placeholder="请输入" value="{{ hazardDesc2 }}" />
</view>
<view class="input1">
<input bindinput="changeHazardDescStatus2" type="text" placeholder=" 请输入" value="{{ hazardDesc2 }}" />
</view>
</view>
<view class="prosecutors">
@ -138,7 +137,7 @@
</view>
<text class="text_27">备注</text>
<view class="textarea1">
<textarea placeholder-style="color: #C1C1C1;" bindinput="bindRemarkInput" maxlength="100" placeholder-class="gray" placeholder="请输入" />
<textarea placeholder-style="color: #C1C1C1;" bindinput="bindRemarkInput" maxlength="100" placeholder-class="gray" placeholder=" 请输入" />
</view>
</view>
</view>

104
subpages/safetyinspection/pages/safetyinspection/safetyinspection.js

@ -4,15 +4,13 @@ const App = getApp()
import {
showRecord,addRecord,inspectionStaff,securityCheckk
} from "../../../../utils/api"
import {timestampToTime} from "../../../../utils/index"
const config = require('../../../../utils/config')
Page({
/**
* 页面的初始数据
*/
data: {
checkboxOptionsnumber:0,
orgid:'',
orgType:'',
pageNo:'1',
@ -21,7 +19,6 @@ Page({
imageUrls:[],
remark:'',//备注
reviewTime:'',
checkResultFlag:'',
array: ['不合格', '合格'], // 选择器的数据源
arrlist:[],
fileList: [],
@ -37,21 +34,26 @@ Page({
uploadImageList: [],//图片上传的数组
imageId:1,
addHiddenDangeList:[],
currentDate:null,
currentDate: new Date().getTime(),
minDate: new Date(2020, 0, 1).getTime(),
maxDate: new Date(2030, 11, 31).getTime(),
showtime:false,
checkResultFlag:null,
checkResultFlagRouter:null,
hazardStatus2:null
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
companyId: options.resiId,
orgid:App.globalData.user.agencyId
})
console.log(App.globalData)
if(options){
this.setData({
companyId: options.resiId,
orgid:App.globalData.user.agencyId,
checkResultFlagRouter:options.flag,
currentDateShow:timestampToTime(new Date().getTime(),1)
})
}
this.showRecordData()
this.toOinspectionStaff()
this.securityCheckk()
@ -67,13 +69,9 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
console.log(111111);
debugger
console.log(this.getCurrentDateTime());
this.setData({
currentDate:this.getCurrentDateTime()
})
// this.setData({
// currentDate:this.getCurrentDateTime()
// })
},
/**
@ -118,7 +116,7 @@ Page({
});
});
},
showTime(){
handelShowTime(){
this.setData({
showtime:true
})
@ -138,6 +136,14 @@ Page({
checkboxValue:event.detail,
})
},
handelConfirmDate(value){
this.setData({
showtime:false,
currentDateShow:timestampToTime(value.detail,1),
currentDate:value.detail
})
},
afterRead(event) {
const {
file
@ -172,21 +178,34 @@ Page({
id: this.data.companyId
}
showRecord(parm).then(res => {
console.log(res)
res.data.forEach(item => {
if (item.hiddenDangeList) {
item.hiddenDangeList0 = [];
item.hiddenDangeList1 = [];
item.hiddenDangeList2 = [];
item.hiddenDangeList.forEach(itemC => {
if (itemC.hazardStatus === 0) {
item.hiddenDangeList0.push(itemC);
} else if (itemC.hazardStatus === 1) {
item.hiddenDangeList1.push(itemC);
}else if (itemC.hazardStatus === 2) {
item.hiddenDangeList2.push(itemC);
}
});
}
});
if(res.data[0].hiddenDangeList){
let checkboxOptions = res.data[0].hiddenDangeList.filter(item=>item.hazardStatus === 0).map(item=>({hazardDesc:item.hazardDesc,hazardStatus:1}));
let checkboxOptionsnumber=checkboxOptions.length+1;
console.log(checkboxOptionsnumber)
this.setData({
checkboxOptions,
checkboxOptionsnumber
})
}
this.setData({
showList:res.data
})
console.log(this.data.checkboxOptions)
console.log(this.data.showList)
console.log(this.data.showList,'seeeeee')
})
},
toOinspectionStaff(){
@ -247,8 +266,6 @@ Page({
this.setData({
newContent: e.detail.value
});
console.log('添加后的数组:', this.data.newContent);
console.log(this.data.checkboxOptions)
},
// 删除选中的图片
@ -262,6 +279,11 @@ Page({
uploadImageList: this.data.uploadImageList
})
}
},
changenewHazardStatus2(e){
this.setData({
hazardStatus2:e.detail.value
})
},
getCurrentDateTime() {
const now = new Date();
@ -271,15 +293,10 @@ Page({
const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0');
const seconds = now.getSeconds().toString().padStart(2, '0');
debugger
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
handelClickSave(){
console.log(this.data.checkboxOptions)
console.log(this.data.newContent)
console.log("zhixingle")
console.log(this.data.newContent)
if (this.data.newContent) {
let newArr = this.data.addHiddenDangeList.concat({
hazardDesc: this.data.newContent,
@ -306,13 +323,20 @@ handelClickSave(){
})
return false
}
if(this.data.checkResultFlag == 0 && !this.data.getData){
if(this.data.checkResultFlag == 0 && !this.data.currentDate){
wx.showToast({
title: '请选择拟复查时间',
icon:'none'
})
return false
}
if(this.data.checkResultFlagRouter == 1 && !this.data.hazardStatus2){
wx.showToast({
title: '请填写整改要求',
icon:'none'
})
return false
}
console.log(this.data.checkboxOptions)
let hasHazardStatus1 = false;
this.data.checkboxOptions.forEach(item => {
@ -331,7 +355,6 @@ handelClickSave(){
// }
// });
// console.log(checkbox)
console.log( "11",hasHazardStatus1)
if(this.data.checkResultFlag == 0 && !hasHazardStatus1 && this.data.addHiddenDangeList.length<1){
console.log("1111",hasHazardStatus1)
wx.showToast({
@ -344,26 +367,23 @@ if(this.data.checkResultFlag == 0 && !hasHazardStatus1 && this.data.addHiddenDan
const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0');
const seconds = now.getSeconds().toString().padStart(2, '0');
console.log(this.data.checkboxOptions)
console.log(this.data.addHiddenDangeList)
let form = {
companyId:this.data.companyId,
checkTime:this.getCurrentDateTime(),
checkPersonsIdList:this.data.selectedOptions,
checkResultFlag:this.data.checkResultFlag,
reviewTime:this.data.getData,
reviewTime:this.data.checkResultFlag === '1'?null:timestampToTime(this.data.currentDate,1),
hiddenDangeList:this.data.checkboxOptions.concat(this.data.addHiddenDangeList),
attachmentUrls:this.data.uploadImageList.map(item=>({fileName:item.originFileName,attachmentUrl:item.ossUrl.url})),
remark:this.data.remark,
address:""
}
console.log(this.data.checkboxOptions)
console.log(this.data.addHiddenDangeList)
console.log(this.data.hiddenDangeList)
if (!this.data.reviewTime) {
form.reviewTime=null
if(this.data.hazardStatus2){
form.hiddenDangeList.push({hazardDesc:this.data.hazardStatus2,hazardStatus:2})
}
console.log(this.data.checkboxOptions.concat(this.data.addHiddenDangeList))
this.setData({
newContent:null
})
addRecord(form).then(res => {
if(res.code == 0){
wx.showToast({

92
subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml

@ -13,12 +13,27 @@
</view></view>
</view>
<view class="prosecutors" >
<text class="prosecutors_req">*</text>
<view class="nes">
<view class="conclusion">
<text class="prosecutors_pre">检查结论</text>
<picker class="prosecutors_name" bindchange="pickerChange" value="{{checkResultFlag}}" range="{{array}}">
<view class="{{checkResultFlagName?'':'gray'}}">
{{checkResultFlagName?checkResultFlagName:'请选择'}}
</view>
</picker>
</view>
<view class="conclusion_right">
<image src="../../../../images/right.png" class="prosecutors_img"></image>
</view></view>
</view>
<view class="pitfall">
<view class="prosecutors" style="border-bottom: none;">
<view>
<text class="prosecutors_req" wx:if="{{checkResultFlag == 0}}">*</text>
<text class="prosecutors_pre1">未整改隐患</text>
<text class="prosecutors_pre1">{{checkResultFlagRouter === '1'?'隐患明细':'未整改隐患'}}</text>
</view>
</view>
<view class="checkbox1">
@ -38,35 +53,26 @@
<text>再添加一条</text>
</view> -->
</view>
<view class="prosecutors" >
<view class="prosecutors" wx:if="{{checkResultFlagRouter == 1}}">
<text class="prosecutors_req">*</text>
<view class="nes">
<view class="conclusion">
<text class="prosecutors_pre">检查结论</text>
<picker class="prosecutors_name" bindchange="pickerChange" value="{{checkResultFlag}}" range="{{array}}">
<view class="{{checkResultFlagName?'':'gray'}}">
{{checkResultFlagName?checkResultFlagName:'请选择'}}
</view>
</picker>
<text class="prosecutors_pre">整改要求</text>
<input type="text" placeholder="请填写整改要求" bindinput="changenewHazardStatus2" value="{{hazardStatus2}}" style="margin-left: 10rpx;"/>
</view>
<view class="conclusion_right">
<image src="../../../../images/right.png" class="prosecutors_img"></image>
</view></view>
</view>
</view>
</view>
<view class="prosecutors" >
<text class="prosecutors_req" wx:if="{{checkResultFlag == 0}}">*</text>
<view class="nes" bind:tap="showTime">
<view class="prosecutors" wx:if="{{checkResultFlag == 0}}">
<text class="prosecutors_req">*</text>
<view class="nes" bind:tap="handelShowTime">
<view class="conclusion">
<text class="prosecutors_pre">拟复查时间</text>
<view class="{{currentDate?'prosecutors_name':'gray'}}">
{{currentDate?currentDate:'请选择'}}
</view>
<!-- <picker mode="date" class="prosecutors_name" bindchange="pickerChange1" value="{{reviewTime}}">
<view class="{{reviewTime?'':'gray'}}">
{{reviewTime?reviewTime:'请选择'}}
<view class="{{currentDateShow?'prosecutors_name':'gray'}}">
{{currentDateShow?currentDateShow:'请选择'}}
</view>
</picker> -->
</view>
<view class="conclusion_right">
<image src="../../../../images/right.png" class="prosecutors_img"></image>
@ -102,7 +108,7 @@
<view class="text2">
巡查记录
</view>
<view class="logsBox" wx:for="{{showList}}" wx:for-index="index">
<view class="logsBox" wx:for="{{showList}}" wx:for-index="index" wx:key="index">
<view class="item-dian {{index!=0?'item-dian1':''}}">
<view class="neidian"></view>
</view>
@ -112,8 +118,8 @@
<view class="logs-content">
<view class="logs-content-left">
<view>
<text class="logs-content-title">检人员:</text>
<text class="logs-content-txt">{{item.chekPersons||'--'}}</text>
<text class="logs-content-title">检人员:</text>
<text class="logs-content-txt">{{item.checkPersons||'--'}}</text>
</view>
<view>
<text class="logs-content-title">检查结论:</text>
@ -121,15 +127,19 @@
</view>
<view>
<text class="logs-content-title">{{index==0?'未整改隐患: ':'隐患明细:'}}</text>
<text class="logs-content-txt" name="{{index}}" wx:for="{{item.hiddenDangeList}}">{{index + 1}}.{{item.hazardDesc}}</text>
<text class="logs-content-txt" name="{{index}}" wx:for="{{item.hiddenDangeList0}}">{{index + 1}}.{{item.hazardDesc}}</text>
</view>
<view wx:if="{{index}}">
<view>
<text class="logs-content-title" wx:if="{{item.hiddenDangeList2.length == 0}}">已整改隐患:</text>
<text class="logs-content-txt" name="{{index}}" wx:for="{{item.hiddenDangeList1}}">{{index + 1}}.{{item.hazardDesc}}</text>
</view>
<view wx:if="{{item.hiddenDangeList2.length != 0}}">
<text class="logs-content-title">整改要求:</text>
<text class="logs-content-txt" wx:for="{{item.hiddenDangeList}}">{{item.hazardStatus}}</text>
<text class="logs-content-txt" wx:for="{{item.hiddenDangeList2}}">{{index + 1}}.{{item.hazardDesc}}</text>
</view>
<view wx:if="{{index}}">
<view >
<text class="logs-content-title">拟复查时间:</text>
<text class="logs-content-txt">{{item.reviewTime}}</text>
<text class="logs-content-txt">{{item.reviewTime || '--'}}</text>
</view>
<view>
<text class="logs-content-title">附件:</text>
@ -165,23 +175,13 @@
</view>
</van-popup>
<wux-actionsheet id="wux-actionsheet" />
<view class="container">
<van-datetime-picker wx:if="{{showtime}}"
type="datetime"
value="{{ currentDate }}"
min-date="{{ minDate }}"
max-date="{{ maxDate }}"
bind:input="onInput"
/>
</view>
<van-popup show="{{ showtime }}" close-icon="close" position="bottom" custom-style="height: 50%" bind:close="closePopup" round>
<van-datetime-picker
type="datetime"
value="{{ currentDate }}"
min-date="{{ minDate }}"
max-date="{{ maxDate }}"
bind:input="onInput"
bind:confirm="onConfirm"
bind:cancel="onCancel"
/>
type="datetime"
value="{{ currentDate }}"
min-date="{{ minDate }}"
max-date="{{ maxDate }}"
bind:confirm="handelConfirmDate"
bind:input="onInput"
/>
</van-popup>

5
subpages/securityCheck/pages/securityCheck.js

@ -20,7 +20,6 @@ Page({
},
onLoad(options) {
this.getList()
},
@ -133,7 +132,7 @@ onScrollToLower(e){
* 生命周期函数--监听页面显示
*/
onShow() {
this.getList()
},
@ -176,7 +175,7 @@ onScrollToLower(e){
toDetails(e){
console.log(e)
wx.navigateTo({
url: `../../../subpages/safetyinspection/pages/safetyinspection/safetyinspection?resiId=${e.currentTarget.dataset.resiid}`,
url: `../../../subpages/safetyinspection/pages/safetyinspection/safetyinspection?resiId=${e.currentTarget.dataset.resiid}&flag=${e.currentTarget.dataset.flag}`,
})
}

4
subpages/securityCheck/pages/securityCheck.wxml

@ -12,7 +12,7 @@
<view class="section_5">
<scroll-view scroll-y="{{true}}" scroll-into-view="scrollToHere" wx:if="{{waitingCheckStyle}}" style="width: 100%; height: 90vh;"
lower-threshold="{{ lowerThreshold }}" bindscrolltolower="onScrollToLower">
<view class="list_1" wx:for="{{flag0Array}}" bind:tap="toDetails" data-resiId="{{item.id}}">
<view class="list_1" wx:for="{{flag0Array}}" bind:tap="toDetails" data-flag="{{item.checkResultFlag}}" data-resiId="{{item.id}}">
<view class="section_1-0" id="scrollToHere">
<view class="title">{{item.name}}</view>
<view class="title_mall">检查时间: {{item.orderDate}}</view>
@ -31,7 +31,7 @@
<scroll-view scroll-y="{{true}}" scroll-into-view="scrollToHere" wx:if="{{qualifiedStyle}}" style="width: 100%; height: 90vh;" lower-threshold="{{ lowerThreshold }}" bindscrolltolower="onScrollToLower">
<view class="list_1" wx:for="{{flag1Array}}" data-resiId="{{item.id}}" bind:tap="toDetails">
<view class="list_1" wx:for="{{flag1Array}}" data-resiId="{{item.id}}" bind:tap="toDetails" data-flag="{{item.checkResultFlag}}">
<view class="section_1-0" id="scrollToHere" >
<view class="title">{{item.name}}</view>
<view class="title_mall">检查时间: {{item.orderDate}}</view>

27
utils/index.js

@ -8,4 +8,29 @@ export function encryptedData(key, data) {
// 加密数据
return encryptor.encrypt(data);
}
// 使用方法:
// timestampToTime(1591841249) //返回2020-06-11
// timestampToTime(1591841249,1) //返回 2020-06-11 10:10:10
// timestampToTime(1591841249,2) //返回2020年06月11日
export function timestampToTime(value, type = 0){
var time = new Date(value);
var year = time.getFullYear();
var month = time.getMonth() + 1;
var date = time.getDate();
var hour = time.getHours();
var minute = time.getMinutes();
var second = time.getSeconds();
month = month < 10 ? "0" + month : month;
date = date < 10 ? "0" + date : date;
hour = hour < 10 ? "0" + hour : hour;
minute = minute < 10 ? "0" + minute : minute;
second = second < 10 ? "0" + second : second;
var arr = [
year + "-" + month + "-" + date,
year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second,
year + "年" + month + "月" + date,
year + "年" + month + "月" + date + " " + hour + ":" + minute + ":" + second,
hour + ":" + minute + ":" + second
]
return arr[type];
}
Loading…
Cancel
Save