Browse Source

巡查上报-提交后返回安检巡查列表,列表未刷新巡查上报拟复查时间选择的日期,但是巡查记录中显示的是到具体时分秒,选择时也应该是选择具体时分秒

data-page-V4.3.1
是小王呀\24601 1 year ago
parent
commit
881c07d679
  1. 126
      subpages/InspectionReport/pages/InspectionReport/InspectionReport.js
  2. 3
      subpages/InspectionReport/pages/InspectionReport/InspectionReport.json
  3. 49
      subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml
  4. 8
      subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxss
  5. 94
      subpages/safetyinspection/pages/safetyinspection/safetyinspection.js
  6. 4
      subpages/safetyinspection/pages/safetyinspection/safetyinspection.json
  7. 37
      subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml

126
subpages/InspectionReport/pages/InspectionReport/InspectionReport.js

@ -8,13 +8,17 @@ const App = getApp()
import { import {
addRecord, addRecord,
securityCheckk, securityCheckk,
inspectionStaff inspectionStaff,
showRecord
} from "../../../../utils/api" } from "../../../../utils/api"
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
showtime:false,
checkboxOptions:[],
checkboxOptionsnumber:0,
hiddenDangeList: [], hiddenDangeList: [],
newObj:[], newObj:[],
addRecord: [], addRecord: [],
@ -58,6 +62,12 @@ Page({
imageId: 1, imageId: 1,
arr: [], arr: [],
arr1: [], 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.reverseLocation()
this.getList() 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() { getCurrentDateTime() {
const now = new Date(); const now = new Date();
@ -104,7 +143,7 @@ Page({
}) })
return false return false
} }
if(this.data.checkResultFlag == 0 && !this.data.reviewTime){ if(this.data.checkResultFlag == 0 && !this.data.getData){
wx.showToast({ wx.showToast({
title: '请选择拟复查时间', title: '请选择拟复查时间',
icon:'none' icon:'none'
@ -122,17 +161,23 @@ Page({
const hours = now.getHours().toString().padStart(2, '0'); const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0'); const minutes = now.getMinutes().toString().padStart(2, '0');
const seconds = now.getSeconds().toString().padStart(2, '0'); const seconds = now.getSeconds().toString().padStart(2, '0');
addRecord({ console.log(this.data.getData)
companyId: this.data.companyId, let form={ companyId: this.data.companyId,
checkTime: this.getCurrentDateTime(), checkTime: this.getCurrentDateTime(),
checkPersonsIdList: this.data.checkPersonsIdList, checkPersonsIdList: this.data.checkPersonsIdList,
checkResultFlag: this.data.checkResultFlag, checkResultFlag: this.data.checkResultFlag,
reviewTime:`${this.data.reviewTime} ${hours}:${minutes}:${seconds}`, reviewTime:this.data.getData,
hiddenDangeList:[...this.data.hiddenDangeList,{hazardStatus:2,hazardDesc:this.data.hazardDesc2}] , hiddenDangeList:this.data.checkboxOptions.concat(this.data.addHiddenDangeList),
attachmentUrls:this.data.uploadImageList.map(item=>({fileName:item.originFileName,attachmentUrl:item.ossUrl.url})), attachmentUrls:this.data.uploadImageList.map(item=>({fileName:item.originFileName,attachmentUrl:item.ossUrl.url})),
remark: '', remark: '',
reviewAddress:this.data.addressContent reviewAddress:this.data.addressContent
}).then( }
if (!this.data.reviewTime) {
form.reviewTime=null
}
addRecord(
form
).then(
res => { res => {
if(res.code == 0){ if(res.code == 0){
wx.showToast({ wx.showToast({
@ -158,7 +203,7 @@ Page({
}).then(({ }).then(({
data data
}) => { }) => {
console.log(data) console.log(data.list)
this.setData({ this.setData({
companyList: data.list, companyList: data.list,
}); });
@ -266,6 +311,9 @@ Page({
selectedNames: names, selectedNames: names,
checkPersonsIdList:this.data.selectedOptions checkPersonsIdList:this.data.selectedOptions
}); // 关闭弹出层 }); // 关闭弹出层
},
onCloseTime(){
}, },
onChange1(event) { onChange1(event) {
console.log(event) console.log(event)
@ -299,27 +347,18 @@ Page({
hazardDesc2: e.detail.value hazardDesc2: e.detail.value
}); });
}, },
addAnother() { changenewContent(e){
let newValue = this.data.arr1.length + 1; // 根据addAnother数组长度确定新值
let newArr = this.data.arr1.concat({
value: newValue.toString(),
name: this.data.hazardDesc
});
this.setData({ this.setData({
arr1: newArr, newContent: e.detail.value
hazardDesc: '', // 清空输入框的值
}); });
const nameArray = this.data.arr1.map(item => item.name); },
nameArray.forEach(value => { addAnother() {
// 创建一个新的对象,设置 hazardDesc 属性为当前值 let newArr = this.data.addHiddenDangeList.concat({ hazardDesc: this.data.newContent, hazardStatus: 0 });
this.data.newObj = { this.setData({
hazardStatus: '0', // 如果需要同时设置 hazardStatus 属性,可以在这里进行设置 addHiddenDangeList: newArr,
hazardDesc: value newContent: '', // 清空输入框的值
}; });
}); console.log('添加后的数组:', this.data.addHiddenDangeList);
this.data.hiddenDangeList.push(this.data.newObj);
console.log(this.data.hiddenDangeList)
}, },
pickerChange: function (e) { pickerChange: function (e) {
this.setData({ this.setData({
@ -343,6 +382,7 @@ Page({
gridNName: this.data.companyList[e.detail.value].name, gridNName: this.data.companyList[e.detail.value].name,
companyId:this.data.companyList[e.detail.value].id companyId:this.data.companyList[e.detail.value].id
}); });
this.showRecordData()
}, },
bindRemarkInput(e) { bindRemarkInput(e) {
this.setData({ 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 });
}
}) })

3
subpages/InspectionReport/pages/InspectionReport/InspectionReport.json

@ -8,6 +8,7 @@
"van-checkbox": "@vant/weapp/checkbox/index", "van-checkbox": "@vant/weapp/checkbox/index",
"van-checkbox-group": "@vant/weapp/checkbox-group/index", "van-checkbox-group": "@vant/weapp/checkbox-group/index",
"van-popup": "@vant/weapp/popup/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"
} }
} }

49
subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml

@ -48,12 +48,13 @@
</view> </view>
</view> </view>
<view class="checkbox1"> <view class="checkbox1">
<van-checkbox-group value="{{ result }}" bind:change="onChange"> <view class="addHiddenDangeList">
<van-checkbox custom-class="group" data-value="{{item.value}}" name="{{item.value}}" wx:for="{{arr1}}" >{{item.name}}</van-checkbox> <text wx:for="{{addHiddenDangeList}}" wx:for-index="index" class="addHiddenDangeListText"
</van-checkbox-group> wx:for-item="item">{{index+1}}.{{item.hazardDesc}}</text>
</view>
</view> </view>
<view class="input1"> <view class="input1">
<input bindinput="changeHazardDesc" type="text" value="{{hazardDesc}}" placeholder=" 请输入" /> <input bindinput="changenewContent" type="text" value="{{newContent}}" placeholder=" 请输入" />
</view> </view>
<view class="add" bind:tap="addAnother"> <view class="add" bind:tap="addAnother">
<image src="../../../../images/add.png" class="add_img"></image> <image src="../../../../images/add.png" class="add_img"></image>
@ -97,14 +98,18 @@
</view> </view>
<view class="prosecutors"> <view class="prosecutors">
<text class="prosecutors_req" wx:if="{{checkResultFlag == 0}}">*</text> <text class="prosecutors_req" wx:if="{{checkResultFlag == 0}}">*</text>
<view class="nes"> <view class="nes" bind:tap="showTime" >
<view class="conclusion"> <view class="conclusion">
<text class="prosecutors_pre">拟复查时间</text> <text class="prosecutors_pre">拟复查时间</text>
<picker mode="date" class="prosecutors_name" bindchange="pickerChange1" value="{{data}}"> <view class="{{getData?'prosecutors_name':'gray'}}">
{{getData?getData:'请选择'}}
</view>
<!-- <picker mode="date" class="prosecutors_name" bindchange="pickerChange1" value="{{data}}">
<view class="{{getData?'':'gray'}}"> <view class="{{getData?'':'gray'}}">
{{getData?getData:'请选择'}} {{getData?getData:'请选择'}}
</view> </view>
</picker> </picker> -->
</view> </view>
<view class="conclusion_right"> <view class="conclusion_right">
<image src="../../../../images/right.png" class="prosecutors_img"></image> <image src="../../../../images/right.png" class="prosecutors_img"></image>
@ -151,5 +156,33 @@
</van-checkbox-group> </van-checkbox-group>
</view> </view>
</van-popup> </van-popup>
<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"
/>
</van-popup>
<!-- <van-popup show="{{ showTime }}" closeable close-icon="close" position="bottom" custom-style="height: 50%" bind:close="onClose" round>
<view class="popup-content">
<van-checkbox-group value="{{selectedOptions}}" bind:change="onChange1">
<van-checkbox name="{{item.staffId}}" custom-class="checkbox" wx:for="{{arr}}">{{item.name}}</van-checkbox>
</van-checkbox-group>
</view>
</van-popup> -->
<!-- <van-popup show="{{ showTime }}" position="bottom" bind:close="closePopup" custom-style="height: 50%">
<van-datetime-picker
type="datetime"
value="{{ currentDate }}"
min-date="{{ minDate }}"
max-date="{{ maxDate }}"
bind:input="onInput"
bind:confirm="onConfirm"
bind:cancel="onCancel"
/>
</van-popup> -->

8
subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxss

@ -290,6 +290,14 @@ page {
margin-left: 50rpx; margin-left: 50rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.addHiddenDangeList{
display: flex;
flex-direction: column;
margin-left: 70rpx;
}
.addHiddenDangeListText {
margin-bottom: 20rpx;
}
.group{ .group{
margin-top: 20rpx; margin-top: 20rpx;
} }

94
subpages/safetyinspection/pages/safetyinspection/safetyinspection.js

@ -11,6 +11,7 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
checkboxOptionsnumber:0, checkboxOptionsnumber:0,
orgid:'', orgid:'',
orgType:'', orgType:'',
@ -35,7 +36,11 @@ Page({
checkboxValue:[], checkboxValue:[],
uploadImageList: [],//图片上传的数组 uploadImageList: [],//图片上传的数组
imageId:1, 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) { onChange(event) {
console.log(event.detail); console.log(event.detail);
this.data.checkboxOptions.forEach((item,index)=>{ this.data.checkboxOptions.forEach((item,index)=>{
if(event.detail.findIndex(item=>item==index) != -1){ if(event.detail.findIndex(item=>item==index) != -1){
item.hazardStatus = 1
}else{
item.hazardStatus = 0 item.hazardStatus = 0
}else{
item.hazardStatus = 1
} }
}) })
this.setData({ this.setData({
@ -182,7 +192,6 @@ Page({
}) })
}, },
showPopup() { showPopup() {
this.setData({ showPopup: true }); // 点击按钮显示弹出层 this.setData({ showPopup: true }); // 点击按钮显示弹出层
}, },
@ -227,12 +236,28 @@ Page({
}); });
}, },
addAnother() { addAnother() {
let newArr = this.data.addHiddenDangeList.concat({ hazardDesc: this.data.newContent, hazardStatus: 0 }); if ( !this.data.newContent) {
this.setData({ wx.showModal({
addHiddenDangeList: newArr, title: '提示',
newContent: '', // 清空输入框的值 content: '输入不能为空',
}); success (res) {
console.log('添加后的数组:', this.data.addHiddenDangeList); 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 return false
} }
const now = new Date(); const now = new Date();
const hours = now.getHours().toString().padStart(2, '0'); const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0'); const minutes = now.getMinutes().toString().padStart(2, '0');
@ -482,6 +506,22 @@ pickerChange: function(e) {
checkResultFlag:e.detail.value, checkResultFlag:e.detail.value,
checkResultFlagName:this.data.array[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) { pickerChange1: function(e) {
this.setData({ this.setData({
@ -495,6 +535,38 @@ bindRemarkInput(e){
console.log(this.data.remark) console.log(this.data.remark)
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 });
}
}) })

4
subpages/safetyinspection/pages/safetyinspection/safetyinspection.json

@ -7,7 +7,9 @@
"van-uploader": "@vant/weapp/uploader/index", "van-uploader": "@vant/weapp/uploader/index",
"van-popup": "@vant/weapp/popup/index", "van-popup": "@vant/weapp/popup/index",
"van-picker": "@vant/weapp/picker/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": { "permissions": {
"scope.record": true "scope.record": true

37
subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml

@ -56,14 +56,17 @@
</view> </view>
<view class="prosecutors" > <view class="prosecutors" >
<text class="prosecutors_req" wx:if="{{checkResultFlag == 0}}">*</text> <text class="prosecutors_req" wx:if="{{checkResultFlag == 0}}">*</text>
<view class="nes"> <view class="nes" bind:tap="showTime">
<view class="conclusion"> <view class="conclusion">
<text class="prosecutors_pre">拟复查时间</text> <text class="prosecutors_pre">拟复查时间</text>
<picker mode="date" class="prosecutors_name" bindchange="pickerChange1" value="{{reviewTime}}"> <view class="{{getData?'prosecutors_name':'gray'}}">
{{getData?getData:'请选择'}}
</view>
<!-- <picker mode="date" class="prosecutors_name" bindchange="pickerChange1" value="{{reviewTime}}">
<view class="{{reviewTime?'':'gray'}}"> <view class="{{reviewTime?'':'gray'}}">
{{reviewTime?reviewTime:'请选择'}} {{reviewTime?reviewTime:'请选择'}}
</view> </view>
</picker> </picker> -->
</view> </view>
<view class="conclusion_right"> <view class="conclusion_right">
<image src="../../../../images/right.png" class="prosecutors_img"></image> <image src="../../../../images/right.png" class="prosecutors_img"></image>
@ -117,14 +120,14 @@
<text class="logs-content-txt">{{item.checkResultFlag == 1?'合格':'不合格'}}</text> <text class="logs-content-txt">{{item.checkResultFlag == 1?'合格':'不合格'}}</text>
</view> </view>
<view> <view>
<text class="logs-content-title">隐患明细:</text> <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.hiddenDangeList}}">{{index + 1}}.{{item.hazardDesc}}</text>
</view> </view>
<view> <view wx:if="{{index}}">
<text class="logs-content-title">整改要求:</text> <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.hiddenDangeList}}">{{item.hazardStatus}}</text>
</view> </view>
<view> <view wx:if="{{index}}">
<text class="logs-content-title">拟复查时间:</text> <text class="logs-content-title">拟复查时间:</text>
<text class="logs-content-txt">{{item.reviewTime}}</text> <text class="logs-content-txt">{{item.reviewTime}}</text>
</view> </view>
@ -162,3 +165,23 @@
</view> </view>
</van-popup> </van-popup>
<wux-actionsheet id="wux-actionsheet" /> <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"
/>
</van-popup>
Loading…
Cancel
Save