diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js
index 96809f5..098a458 100644
--- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js
+++ b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js
@@ -8,13 +8,17 @@ const App = getApp()
import {
addRecord,
securityCheckk,
- inspectionStaff
+ inspectionStaff,
+ showRecord
} from "../../../../utils/api"
Page({
/**
* 页面的初始数据
*/
data: {
+ showtime:false,
+ checkboxOptions:[],
+ checkboxOptionsnumber:0,
hiddenDangeList: [],
newObj:[],
addRecord: [],
@@ -58,6 +62,12 @@ Page({
imageId: 1,
arr: [],
arr1: [],
+ addHiddenDangeList:[],
+ checkboxValue:[],
+ newContent:'',
+ currentDate: new Date().getTime(),
+ minDate: new Date(2020, 0, 1).getTime(),
+ maxDate: new Date(2030, 11, 31).getTime()
},
/**
* 生命周期函数--监听页面加载
@@ -71,6 +81,35 @@ Page({
})
this.reverseLocation()
this.getList()
+
+ },
+ showTime(){
+ this.setData({
+ showtime:true
+ })
+ },
+
+ showRecordData() {
+ console.log(this.data.companyId)
+ 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)
+ this.setData({
+ checkboxOptions,
+ checkboxOptionsnumber
+ })
+ }
+ this.setData({
+ showList:res.data
+ })
+ console.log(this.data.showList)
+ })
},
getCurrentDateTime() {
const now = new Date();
@@ -104,7 +143,7 @@ Page({
})
return false
}
- if(this.data.checkResultFlag == 0 && !this.data.reviewTime){
+ if(this.data.checkResultFlag == 0 && !this.data.getData){
wx.showToast({
title: '请选择拟复查时间',
icon:'none'
@@ -122,17 +161,23 @@ 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');
- addRecord({
- companyId: this.data.companyId,
+ console.log(this.data.getData)
+ let form={ companyId: this.data.companyId,
checkTime: this.getCurrentDateTime(),
checkPersonsIdList: this.data.checkPersonsIdList,
checkResultFlag: this.data.checkResultFlag,
- reviewTime:`${this.data.reviewTime} ${hours}:${minutes}:${seconds}`,
- hiddenDangeList:[...this.data.hiddenDangeList,{hazardStatus:2,hazardDesc:this.data.hazardDesc2}] ,
+ reviewTime:this.data.getData,
+ hiddenDangeList:this.data.checkboxOptions.concat(this.data.addHiddenDangeList),
attachmentUrls:this.data.uploadImageList.map(item=>({fileName:item.originFileName,attachmentUrl:item.ossUrl.url})),
remark: '',
reviewAddress:this.data.addressContent
- }).then(
+ }
+ if (!this.data.reviewTime) {
+ form.reviewTime=null
+ }
+ addRecord(
+ form
+ ).then(
res => {
if(res.code == 0){
wx.showToast({
@@ -158,7 +203,7 @@ Page({
}).then(({
data
}) => {
- console.log(data)
+ console.log(data.list)
this.setData({
companyList: data.list,
});
@@ -266,6 +311,9 @@ Page({
selectedNames: names,
checkPersonsIdList:this.data.selectedOptions
}); // 关闭弹出层
+ },
+ onCloseTime(){
+
},
onChange1(event) {
console.log(event)
@@ -299,27 +347,18 @@ Page({
hazardDesc2: e.detail.value
});
},
- addAnother() {
- let newValue = this.data.arr1.length + 1; // 根据addAnother数组长度确定新值
- let newArr = this.data.arr1.concat({
- value: newValue.toString(),
- name: this.data.hazardDesc
- });
+ changenewContent(e){
this.setData({
- arr1: newArr,
- hazardDesc: '', // 清空输入框的值
+ newContent: e.detail.value
});
- const nameArray = this.data.arr1.map(item => item.name);
- nameArray.forEach(value => {
- // 创建一个新的对象,设置 hazardDesc 属性为当前值
- this.data.newObj = {
- hazardStatus: '0', // 如果需要同时设置 hazardStatus 属性,可以在这里进行设置
- hazardDesc: value
- };
- });
-
- this.data.hiddenDangeList.push(this.data.newObj);
- console.log(this.data.hiddenDangeList)
+ },
+ addAnother() {
+ let newArr = this.data.addHiddenDangeList.concat({ hazardDesc: this.data.newContent, hazardStatus: 0 });
+ this.setData({
+ addHiddenDangeList: newArr,
+ newContent: '', // 清空输入框的值
+ });
+ console.log('添加后的数组:', this.data.addHiddenDangeList);
},
pickerChange: function (e) {
this.setData({
@@ -343,6 +382,7 @@ Page({
gridNName: this.data.companyList[e.detail.value].name,
companyId:this.data.companyList[e.detail.value].id
});
+ this.showRecordData()
},
bindRemarkInput(e) {
this.setData({
@@ -598,4 +638,36 @@ Page({
}
})
},
+ closePopup() {
+ this.setData({ showPopup: false });
+ },
+
+ onInput(event) {
+ var date = new Date(event.detail);
+ var year = date.getFullYear();
+ var month = ("0" + (date.getMonth() + 1)).slice(-2);
+ var day = ("0" + date.getDate()).slice(-2);
+ var hour = ("0" + date.getHours()).slice(-2);
+ var minute = ("0" + date.getMinutes()).slice(-2);
+ var second = ("0" + date.getSeconds()).slice(-2);
+ var formattedDateTime = year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;
+ console.log(formattedDateTime);
+ this.setData({
+ getData:formattedDateTime
+ })
+
+ },
+
+ onConfirm(event) {
+ const { value } = event.detail;
+ this.setData({
+ currentDate: value,
+ showtime: false
+ });
+ console.log('选中的日期时间:', new Date(value));
+ },
+
+ onCancel() {
+ this.setData({ showtime: false });
+ }
})
\ No newline at end of file
diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.json b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.json
index 3e0357b..2068200 100644
--- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.json
+++ b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.json
@@ -8,6 +8,7 @@
"van-checkbox": "@vant/weapp/checkbox/index",
"van-checkbox-group": "@vant/weapp/checkbox-group/index",
"van-popup": "@vant/weapp/popup/index",
- "van-picker": "@vant/weapp/picker/index"
+ "van-picker": "@vant/weapp/picker/index",
+ "van-datetime-picker": "@vant/weapp/datetime-picker/index"
}
}
\ No newline at end of file
diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml
index 57202fb..2075d59 100644
--- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml
+++ b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml
@@ -48,12 +48,13 @@
-
- {{item.name}}
-
+
+ {{index+1}}.{{item.hazardDesc}}
+
-
+
@@ -97,14 +98,18 @@
*
-
+
拟复查时间
-
+
+ {{getData?getData:'请选择'}}
+
+
+
@@ -151,5 +156,33 @@
-
+
+
+
+
+
diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxss b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxss
index f5bb206..596198b 100644
--- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxss
+++ b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxss
@@ -290,6 +290,14 @@ page {
margin-left: 50rpx;
margin-bottom: 20rpx;
}
+.addHiddenDangeList{
+ display: flex;
+ flex-direction: column;
+ margin-left: 70rpx;
+}
+.addHiddenDangeListText {
+margin-bottom: 20rpx;
+}
.group{
margin-top: 20rpx;
}
diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js
index a612a8a..ca09625 100644
--- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js
+++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js
@@ -11,6 +11,7 @@ Page({
* 页面的初始数据
*/
data: {
+
checkboxOptionsnumber:0,
orgid:'',
orgType:'',
@@ -35,7 +36,11 @@ Page({
checkboxValue:[],
uploadImageList: [],//图片上传的数组
imageId:1,
- addHiddenDangeList:[]
+ addHiddenDangeList:[],
+ currentDate: new Date().getTime(),
+ minDate: new Date(2020, 0, 1).getTime(),
+ maxDate: new Date(2030, 11, 31).getTime(),
+ showtime:false,
},
/**
* 生命周期函数--监听页面加载
@@ -104,13 +109,18 @@ Page({
});
});
},
+ showTime(){
+ this.setData({
+ showtime:true
+ })
+},
onChange(event) {
console.log(event.detail);
this.data.checkboxOptions.forEach((item,index)=>{
if(event.detail.findIndex(item=>item==index) != -1){
- item.hazardStatus = 1
- }else{
item.hazardStatus = 0
+ }else{
+ item.hazardStatus = 1
}
})
this.setData({
@@ -182,7 +192,6 @@ Page({
})
},
-
showPopup() {
this.setData({ showPopup: true }); // 点击按钮显示弹出层
},
@@ -227,12 +236,28 @@ Page({
});
},
addAnother() {
- let newArr = this.data.addHiddenDangeList.concat({ hazardDesc: this.data.newContent, hazardStatus: 0 });
- this.setData({
- addHiddenDangeList: newArr,
- newContent: '', // 清空输入框的值
- });
- console.log('添加后的数组:', this.data.addHiddenDangeList);
+ if ( !this.data.newContent) {
+ wx.showModal({
+ title: '提示',
+ content: '输入不能为空',
+ success (res) {
+ if (res.confirm) {
+ console.log('用户点击确定')
+ } else if (res.cancel) {
+ console.log('用户点击取消')
+ }
+ }
+ })
+ }else{
+ let newArr = this.data.addHiddenDangeList.concat({ hazardDesc: this.data.newContent, hazardStatus: 0 });
+ this.setData({
+ addHiddenDangeList: newArr,
+ newContent: '', // 清空输入框的值
+ });
+ console.log('添加后的数组:', this.data.addHiddenDangeList);
+
+ }
+
},
// 删除选中的图片
@@ -287,7 +312,6 @@ handelClickSave(){
})
return false
}
-
const now = new Date();
const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0');
@@ -482,6 +506,22 @@ pickerChange: function(e) {
checkResultFlag:e.detail.value,
checkResultFlagName:this.data.array[e.detail.value]
});
+ if (e.detail.value) {
+ console.log(this.data.checkboxOptions)
+ if (this.data.addHiddenDangeList && this.data.checkboxOptions.length<0) {
+ wx.showModal({
+ title: '提示',
+ content: '隐患最少输入一条',
+ success (res) {
+ if (res.confirm) {
+ console.log('用户点击确定')
+ } else if (res.cancel) {
+ console.log('用户点击取消')
+ }
+ }
+ })
+ }
+ }
},
pickerChange1: function(e) {
this.setData({
@@ -495,6 +535,38 @@ bindRemarkInput(e){
console.log(this.data.remark)
console.log(this.data.remark)
},
+closePopup() {
+ this.setData({ showPopup: false });
+},
+
+onInput(event) {
+ var date = new Date(event.detail);
+ var year = date.getFullYear();
+ var month = ("0" + (date.getMonth() + 1)).slice(-2);
+ var day = ("0" + date.getDate()).slice(-2);
+ var hour = ("0" + date.getHours()).slice(-2);
+ var minute = ("0" + date.getMinutes()).slice(-2);
+ var second = ("0" + date.getSeconds()).slice(-2);
+ var formattedDateTime = year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;
+ console.log(formattedDateTime);
+ this.setData({
+ getData:formattedDateTime
+ })
+
+},
+
+onConfirm(event) {
+ const { value } = event.detail;
+ this.setData({
+ currentDate: value,
+ showtime: false
+ });
+ console.log('选中的日期时间:', new Date(value));
+},
+
+onCancel() {
+ this.setData({ showtime: false });
+}
})
diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.json b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.json
index 8ecdb53..1e8e5bc 100644
--- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.json
+++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.json
@@ -7,7 +7,9 @@
"van-uploader": "@vant/weapp/uploader/index",
"van-popup": "@vant/weapp/popup/index",
"van-picker": "@vant/weapp/picker/index",
- "wux-actionsheet": "../../../../components/dist/actionsheet/index"
+ "wux-actionsheet": "../../../../components/dist/actionsheet/index",
+ "van-datetime-picker": "@vant/weapp/datetime-picker/index"
+
},
"permissions": {
"scope.record": true
diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml
index ac32554..8728aa8 100644
--- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml
+++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml
@@ -56,14 +56,17 @@
*
-
+
拟复查时间
-
+
+ {{getData?getData:'请选择'}}
+
+
@@ -117,14 +120,14 @@
{{item.checkResultFlag == 1?'合格':'不合格'}}
- 隐患明细:
- {{index + 1}}. {{item.hazardDesc}}
+ {{index==0?'未整改隐患: ':'隐患明细:'}}
+ {{index + 1}}.{{item.hazardDesc}}
-
+
整改要求:
{{item.hazardStatus}}
-
+
拟复查时间:
{{item.reviewTime}}
@@ -162,3 +165,23 @@
+
+
+
+
+
+
\ No newline at end of file