From 31cf5807cc7acdf90dba08baa6e03bf2c95f910a Mon Sep 17 00:00:00 2001
From: mk <2403457699@qq.com>
Date: Wed, 22 May 2024 09:22:55 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=89=E6=A3=80=E5=B7=A1=E6=9F=A5bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../InspectionReport/InspectionReport.js | 67 ++++-------
.../InspectionReport/InspectionReport.wxml | 27 +++--
.../safetyinspection/safetyinspection.js | 104 +++++++++++-------
.../safetyinspection/safetyinspection.wxml | 92 ++++++++--------
subpages/securityCheck/pages/securityCheck.js | 5 +-
.../securityCheck/pages/securityCheck.wxml | 4 +-
utils/index.js | 27 ++++-
7 files changed, 175 insertions(+), 151 deletions(-)
diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js
index e3e2874..3eb514c 100644
--- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js
+++ b/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()
},
diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml
index 5c41e5e..dddd8a0 100644
--- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml
+++ b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml
@@ -44,13 +44,16 @@
*
- 隐患明细
+ {{beforeFlag == 1?'隐患明细':'未整改隐患'}}
+
+ {{index + 1}}. {{item.hazardDesc}}
+
{{index+1}}.{{item.hazardDesc}}
+ wx:for-item="item"> {{item.hazardDesc}}
@@ -62,21 +65,17 @@
-->
-
-
+
-
+ *
+
整改要求
-
-
-
-
+
+
+
+
@@ -138,7 +137,7 @@
备注
-
+
diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js
index 51afc3e..e154477 100644
--- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js
+++ b/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({
diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml
index 24665b1..143b113 100644
--- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml
+++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml
@@ -13,12 +13,27 @@
-
+
+ *
+
+
+ 检查结论
+
+
+ {{checkResultFlagName?checkResultFlagName:'请选择'}}
+
+
+
+
+
+
+
+
*
- 未整改隐患
+ {{checkResultFlagRouter === '1'?'隐患明细':'未整改隐患'}}
@@ -38,35 +53,26 @@
再添加一条
-->
-
+
*
- 检查结论
-
-
- {{checkResultFlagName?checkResultFlagName:'请选择'}}
-
-
+ 整改要求
+
-
-
+
+
-
- *
-
+
+ *
+
拟复查时间
-
- {{currentDate?currentDate:'请选择'}}
-
-
@@ -102,7 +108,7 @@
巡查记录
-
+
@@ -112,8 +118,8 @@
- 检察人员:
- {{item.chekPersons||'--'}}
+ 检查人员:
+ {{item.checkPersons||'--'}}
检查结论:
@@ -121,15 +127,19 @@
{{index==0?'未整改隐患: ':'隐患明细:'}}
- {{index + 1}}.{{item.hazardDesc}}
+ {{index + 1}}.{{item.hazardDesc}}
-
+
+ 已整改隐患:
+ {{index + 1}}.{{item.hazardDesc}}
+
+
整改要求:
- {{item.hazardStatus}}
+ {{index + 1}}.{{item.hazardDesc}}
-
+
拟复查时间:
- {{item.reviewTime}}
+ {{item.reviewTime || '--'}}
附件:
@@ -165,23 +175,13 @@
-
-
-
+ type="datetime"
+ value="{{ currentDate }}"
+ min-date="{{ minDate }}"
+ max-date="{{ maxDate }}"
+ bind:confirm="handelConfirmDate"
+ bind:input="onInput"
+/>
\ No newline at end of file
diff --git a/subpages/securityCheck/pages/securityCheck.js b/subpages/securityCheck/pages/securityCheck.js
index 0245d92..461fd6c 100644
--- a/subpages/securityCheck/pages/securityCheck.js
+++ b/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}`,
})
}
diff --git a/subpages/securityCheck/pages/securityCheck.wxml b/subpages/securityCheck/pages/securityCheck.wxml
index d1afb16..5091305 100644
--- a/subpages/securityCheck/pages/securityCheck.wxml
+++ b/subpages/securityCheck/pages/securityCheck.wxml
@@ -12,7 +12,7 @@
-
+
{{item.name}}
检查时间: {{item.orderDate}}
@@ -31,7 +31,7 @@
-
+
{{item.name}}
检查时间: {{item.orderDate}}
diff --git a/utils/index.js b/utils/index.js
index c370b49..d9f80ac 100644
--- a/utils/index.js
+++ b/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];
+}
\ No newline at end of file