Browse Source

Merge branch 'data-page-V4.3.1' into data-page

data-page-V4.3.1
mk 1 year ago
parent
commit
e89cc9916a
  1. 176
      subpages/InspectionReport/pages/InspectionReport/InspectionReport.js
  2. 3
      subpages/InspectionReport/pages/InspectionReport/InspectionReport.json
  3. 76
      subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml
  4. 9
      subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxss
  5. 209
      subpages/safetyinspection/pages/safetyinspection/safetyinspection.js
  6. 4
      subpages/safetyinspection/pages/safetyinspection/safetyinspection.json
  7. 82
      subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml
  8. 1
      subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxss
  9. 5
      subpages/securityCheck/pages/securityCheck.js
  10. 4
      subpages/securityCheck/pages/securityCheck.wxml
  11. 27
      utils/index.js

176
subpages/InspectionReport/pages/InspectionReport/InspectionReport.js

@ -8,13 +8,16 @@ 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:[],
hiddenDangeList: [], hiddenDangeList: [],
newObj:[], newObj:[],
addRecord: [], addRecord: [],
@ -58,6 +61,13 @@ 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(),
checkboxValue:[]
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
@ -71,6 +81,31 @@ Page({
}) })
this.reverseLocation() this.reverseLocation()
this.getList() this.getList()
},
showTime(){
this.setData({
showtime:true
})
},
showRecordData() {
this.setData({
checkboxOptions:[]
})
let parm = {
id: this.data.companyId
}
showRecord(parm).then(res => {
if(res.data[0].hiddenDangeList){
let checkboxOptions = res.data[0].hiddenDangeList.filter(item=>item.hazardStatus === 0).map(item=>({hazardDesc:item.hazardDesc,hazardStatus:0}));
this.setData({
checkboxOptions: checkboxOptions || [],
beforeFlag: res.data[0].checkResultFlag
})
console.log(this.data.beforeFlag);
}
})
}, },
getCurrentDateTime() { getCurrentDateTime() {
const now = new Date(); const now = new Date();
@ -104,35 +139,72 @@ 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'
}) })
return false return false
} }
if(this.data.checkResultFlag == 0 && this.data.hiddenDangeList.length<0){
if(this.data.checkResultFlag == 0 && this.data.checkboxValue.length<1&&!this.data.newContent){
wx.showToast({ wx.showToast({
title: '请填写隐患明细', title: '隐患明细最少输入一条',
icon:'none' icon:'none'
}) })
return false return false
} }
const now = new Date(); if (this.data.checkboxOptions) {
const hours = now.getHours().toString().padStart(2, '0'); console.log(this.data.checkboxOptions)
const minutes = now.getMinutes().toString().padStart(2, '0'); this.data.checkboxOptions.forEach(item => {
const seconds = now.getSeconds().toString().padStart(2, '0'); console.log(item)
addRecord({ console.log(this.data.checkboxValue)
if(this.data.checkboxValue.findIndex(itemC=>itemC === item.value) == -1){
item.hazardStatus = '1';
}else{
item.hazardStatus = '0';
}
})
}
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.hazardDesc2) {
let newArr = this.data.addHiddenDangeList.concat({
hazardDesc: this.data.hazardDesc2,
hazardStatus: 2
});
console.log(newArr)
this.setData({
addHiddenDangeList: newArr,
});
}
let form={
companyId: this.data.companyId, 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: this.data.remarks,
reviewAddress:this.data.addressContent reviewAddress:this.data.addressContent
}).then( }
// if (!this.data.reviewTime) {
// form.reviewTime=null
// }
console.log(form)
addRecord(
form
).then(
res => { res => {
if(res.code == 0){ if(res.code == 0){
wx.showToast({ wx.showToast({
@ -158,7 +230,7 @@ Page({
}).then(({ }).then(({
data data
}) => { }) => {
console.log(data) console.log(data.list)
this.setData({ this.setData({
companyList: data.list, companyList: data.list,
}); });
@ -212,13 +284,11 @@ Page({
*/ */
onShareAppMessage() {}, onShareAppMessage() {},
onChange(event) { onChange(event) {
console.log("111", event) console.log(event);
this.setData({ this.setData({
result: event.detail checkboxValue: event.detail
}); });
console.log(this.data.result); console.log(this.data.checkboxValue);
console.log(this.data.hiddenDangeList);
}, },
afterRead(event) { afterRead(event) {
const { const {
@ -266,6 +336,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)
@ -298,28 +371,21 @@ Page({
this.setData({ this.setData({
hazardDesc2: e.detail.value hazardDesc2: e.detail.value
}); });
console.log(this.data.hazardDesc2)
}, },
addAnother() { changenewContent(e){
let newValue = this.data.arr1.length + 1; // 根据数组长度确定新值
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, requirements:this.data.hazardDesc2});
this.data.newObj = { console.log()
hazardStatus: '0', // 如果需要同时设置 hazardStatus 属性,可以在这里进行设置 this.setData({
hazardDesc: value addHiddenDangeList: newArr,
}; 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({
@ -341,8 +407,10 @@ Page({
// 更新当前选中的索引 // 更新当前选中的索引
this.setData({ this.setData({
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,
checkboxValue:[]
}); });
this.showRecordData()
}, },
bindRemarkInput(e) { bindRemarkInput(e) {
this.setData({ this.setData({
@ -598,4 +666,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"
} }
} }

76
subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml

@ -44,38 +44,38 @@
<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="conclusion1"> <view class="conclusion1">
<text class="prosecutors_pre">隐患明细</text> <text class="prosecutors_pre">{{beforeFlag == 1?'隐患明细':'未整改隐患'}}</text>
</view> </view>
</view> </view>
<view class="checkbox1"> <view class="checkbox1">
<van-checkbox-group value="{{ result }}" bind:change="onChange"> <van-checkbox-group value="{{checkboxValue}}" bind:change="onChange" wx:if="{{checkboxOptions}}" >
<van-checkbox custom-class="group" data-value="{{item.value}}" name="{{item.value}}" wx:for="{{arr1}}" >{{item.name}}</van-checkbox> <van-checkbox custom-class="group" name="{{item.id}}" wx:for="{{checkboxOptions}}">{{index + 1}}. {{item.hazardDesc}}</van-checkbox>
</van-checkbox-group> </van-checkbox-group>
<view class="addHiddenDangeList">
<text wx:for="{{addHiddenDangeList}}" wx:for-index="index" class="addHiddenDangeListText"
wx:for-item="item"> {{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>
<text>再添加一条</text> <text>再添加一条</text>
</view> -->
</view> </view>
</view>
<view class="pitfall"> <view class="pitfall" wx:if="{{beforeFlag == 1}}">
<view class="prosecutors"> <view class="prosecutors">
<view class="requirement"> <!-- <text class="prosecutors_req">*</text> -->
<view class="conclusion1">
<text class="prosecutors_pre">整改要求</text> <text class="prosecutors_pre">整改要求</text>
</view> </view>
</view> </view>
<!-- <view class="checkbox1">
<van-checkbox-group value="{{ hazardDesc }}"> <view class="input1">
<van-checkbox name="hazardDesc">{{ hazardDesc }}</van-checkbox> <input bindinput="changeHazardDescStatus2" type="text" placeholder=" 请输入" value="{{ hazardDesc2 }}" />
</van-checkbox-group> </view>
</view> -->
<view class="input1">
<input bindinput="changeHazardDescStatus2" type="text" placeholder="请输入" value="{{ hazardDesc2 }}" />
</view>
</view> </view>
<view class="prosecutors"> <view class="prosecutors">
@ -97,14 +97,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?'':'gray'}} prosecutors_name">
{{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>
@ -133,7 +137,7 @@
</view> </view>
<text class="text_27">备注</text> <text class="text_27">备注</text>
<view class="textarea1"> <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> </view>
</view> </view>
@ -151,5 +155,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> -->

9
subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxss

@ -110,7 +110,6 @@ page {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin: 20rpx; margin: 20rpx;
padding-left: 40rpx;
} }
.image1{ .image1{
margin-top: 20rpx; margin-top: 20rpx;
@ -291,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;
} }

209
subpages/safetyinspection/pages/safetyinspection/safetyinspection.js

@ -4,14 +4,13 @@ const App = getApp()
import { import {
showRecord,addRecord,inspectionStaff,securityCheckk showRecord,addRecord,inspectionStaff,securityCheckk
} from "../../../../utils/api" } from "../../../../utils/api"
import {timestampToTime} from "../../../../utils/index"
const config = require('../../../../utils/config') const config = require('../../../../utils/config')
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
checkboxOptionsnumber:0,
orgid:'', orgid:'',
orgType:'', orgType:'',
pageNo:'1', pageNo:'1',
@ -20,7 +19,6 @@ Page({
imageUrls:[], imageUrls:[],
remark:'',//备注 remark:'',//备注
reviewTime:'', reviewTime:'',
checkResultFlag:'',
array: ['不合格', '合格'], // 选择器的数据源 array: ['不合格', '合格'], // 选择器的数据源
arrlist:[], arrlist:[],
fileList: [], fileList: [],
@ -35,21 +33,33 @@ 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,
checkResultFlag:null,
checkResultFlagRouter:null,
hazardStatus2:null,
name:""
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
if(options){
this.setData({ this.setData({
companyId: options.resiId, companyId: options.resiId,
orgid:App.globalData.user.agencyId orgid:App.globalData.user.agencyId,
checkResultFlagRouter:options.flag,
currentDateShow:timestampToTime(new Date().getTime(),1)
}) })
console.log(App.globalData) }
this.showRecordData() this.showRecordData()
this.toOinspectionStaff() this.toOinspectionStaff()
this.securityCheckk() this.securityCheckk()
}, },
/** /**
@ -61,14 +71,18 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow() {
// this.setData({
// currentDate:this.getCurrentDateTime()
// })
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide() { onHide() {
this.setData({
currentDate:null
})
}, },
/** /**
@ -99,24 +113,42 @@ Page({
data data
}) => { }) => {
console.log(data) console.log(data)
var firstItem = data.list[0];
console.log(firstItem)
this.setData({ this.setData({
reviewAddress:firstItem.address,
companyList: data.list, companyList: data.list,
}); });
}); });
}, },
handelShowTime(){
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 console.log("我被选中了")
}else{
item.hazardStatus = 0 item.hazardStatus = 0
}else{
item.hazardStatus = 1
} }
}) })
console.log(this.data.checkboxOptions)
this.setData({ this.setData({
checkboxValue:event.detail, checkboxValue:event.detail,
}) })
}, },
handelConfirmDate(value){
this.setData({
showtime:false,
currentDateShow:timestampToTime(value.detail,1),
currentDate:value.detail
})
},
afterRead(event) { afterRead(event) {
const { const {
file file
@ -150,20 +182,34 @@ Page({
id: this.data.companyId id: this.data.companyId
} }
showRecord(parm).then(res => { 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){ if(res.data[0].hiddenDangeList){
let checkboxOptions = res.data[0].hiddenDangeList.filter(item=>item.hazardStatus === 0).map(item=>({hazardDesc:item.hazardDesc,hazardStatus:0})); 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({ this.setData({
checkboxOptions, checkboxOptions,
checkboxOptionsnumber
}) })
} }
this.setData({ this.setData({
showList:res.data showList:res.data
}) })
console.log(this.data.showList) console.log(this.data.checkboxOptions)
console.log(this.data.showList,'seeeeee')
}) })
}, },
toOinspectionStaff(){ toOinspectionStaff(){
@ -182,7 +228,6 @@ Page({
}) })
}, },
showPopup() { showPopup() {
this.setData({ showPopup: true }); // 点击按钮显示弹出层 this.setData({ showPopup: true }); // 点击按钮显示弹出层
}, },
@ -226,15 +271,7 @@ Page({
newContent: e.detail.value newContent: e.detail.value
}); });
}, },
addAnother() {
let newArr = this.data.addHiddenDangeList.concat({ hazardDesc: this.data.newContent, hazardStatus: 0 });
this.setData({
addHiddenDangeList: newArr,
newContent: '', // 清空输入框的值
});
console.log('添加后的数组:', this.data.addHiddenDangeList);
},
// 删除选中的图片 // 删除选中的图片
deleteImage(e) { deleteImage(e) {
console.log(this.data.uploadImageList,'data中'); console.log(this.data.uploadImageList,'data中');
@ -246,6 +283,11 @@ Page({
uploadImageList: this.data.uploadImageList uploadImageList: this.data.uploadImageList
}) })
} }
},
changenewHazardStatus2(e){
this.setData({
hazardStatus2:e.detail.value
})
}, },
getCurrentDateTime() { getCurrentDateTime() {
const now = new Date(); const now = new Date();
@ -259,6 +301,18 @@ Page({
}, },
handelClickSave(){ handelClickSave(){
if (this.data.newContent) {
let newArr = this.data.addHiddenDangeList.concat({
hazardDesc: this.data.newContent,
hazardStatus: 0
});
console.log(newArr)
this.setData({
addHiddenDangeList: newArr,
});
}
console.log(this.data.checkboxOptions)
console.log(this.data.addHiddenDangeList)
if(this.data.selectedOptions.length === 0){ if(this.data.selectedOptions.length === 0){
wx.showToast({ wx.showToast({
title: '请选择检查人员', title: '请选择检查人员',
@ -273,21 +327,46 @@ handelClickSave(){
}) })
return false return false
} }
if(this.data.checkResultFlag == 0 && !this.data.reviewTime){ if(this.data.checkResultFlag == 0 && !this.data.currentDate){
wx.showToast({ wx.showToast({
title: '请选择拟复查时间', title: '请选择拟复查时间',
icon:'none' icon:'none'
}) })
return false return false
} }
if(this.data.checkResultFlag == 0 && this.data.checkboxOptions.length<0){ if(this.data.checkResultFlagRouter == 1 && !this.data.hazardStatus2){
wx.showToast({ wx.showToast({
title: '请填写隐患明细', title: '请填写整改要求',
icon:'none' icon:'none'
}) })
return false return false
} }
console.log(this.data.checkboxOptions)
let hasHazardStatus1 = false;
this.data.checkboxOptions.forEach(item => {
if (item.hazardStatus === 0) {
hasHazardStatus1 = true;
// 如果找到了符合条件的元素,可以直接 return 结束循环
return;
}
});
// let checkbox = this.data.checkboxOptions.map(item => {
// // item.hazardStatus = 0;
// // return item;
// if (item.hazardStatus = 0) {
// return
// }
// });
// console.log(checkbox)
if(this.data.checkResultFlag == 0 && !hasHazardStatus1 && this.data.addHiddenDangeList.length<1){
console.log("1111",hasHazardStatus1)
wx.showToast({
title: '请填写隐患明细',
icon:'none'
})
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');
@ -297,28 +376,33 @@ handelClickSave(){
checkTime:this.getCurrentDateTime(), checkTime:this.getCurrentDateTime(),
checkPersonsIdList:this.data.selectedOptions, checkPersonsIdList:this.data.selectedOptions,
checkResultFlag:this.data.checkResultFlag, checkResultFlag:this.data.checkResultFlag,
reviewTime:`${this.data.reviewTime} ${hours}:${minutes}:${seconds}`, reviewTime:this.data.currentDateShow,
hiddenDangeList:this.data.checkboxOptions.concat(this.data.addHiddenDangeList), 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:this.data.remark, remark:this.data.remark,
address:"" reviewAddress:""
} }
console.log(this.data.checkboxOptions.concat(this.data.addHiddenDangeList)) if(this.data.hazardStatus2){
addRecord(form).then(res => { form.hiddenDangeList.push({hazardDesc:this.data.hazardStatus2,hazardStatus:2})
if(res.code == 0){
wx.showToast({
title: '新增成功',
duration:2000,
success:function(){
setTimeout(()=>{
wx.navigateBack({
delta: 1
})
},2000)
}
})
} }
}) this.setData({
newContent:null
})
// addRecord(form).then(res => {
// if(res.code == 0){
// wx.showToast({
// title: '新增成功',
// duration:2000,
// success:function(){
// setTimeout(()=>{
// wx.navigateBack({
// delta: 1
// })
// },2000)
// }
// })
// }
// })
console.log(form); console.log(form);
}, },
chooseImage() { chooseImage() {
@ -479,6 +563,7 @@ 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]
}); });
console.log(this.data.checkboxOptions)
}, },
pickerChange1: function(e) { pickerChange1: function(e) {
this.setData({ this.setData({
@ -492,6 +577,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
})
console.log(this.data.getData)
},
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

82
subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml

@ -13,12 +13,27 @@
</view></view> </view></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="pitfall">
<view class="prosecutors" style="border-bottom: none;"> <view class="prosecutors" style="border-bottom: none;">
<view> <view>
<text class="prosecutors_req" wx:if="{{checkResultFlag == 0}}">*</text> <text class="prosecutors_req" wx:if="{{checkResultFlag == 0}}">*</text>
<text class="prosecutors_pre1">未整改隐患</text> <text class="prosecutors_pre1">{{checkResultFlagRouter === '1'?'隐患明细':'未整改隐患'}}</text>
</view> </view>
</view> </view>
<view class="checkbox1"> <view class="checkbox1">
@ -27,44 +42,37 @@
</van-checkbox-group> </van-checkbox-group>
<view class="addHiddenDangeList"> <view class="addHiddenDangeList">
<text wx:for="{{addHiddenDangeList}}" wx:for-index="index" class="addHiddenDangeListText" <text wx:for="{{addHiddenDangeList}}" wx:for-index="index" class="addHiddenDangeListText"
wx:for-item="item">{{index + checkboxOptionsnumber wx:for-item="item"> {{item.hazardDesc}}</text>
}}. {{item.hazardDesc}}</text>
</view> </view>
</view> </view>
<view class="input1"> <view class="input1">
<input bindinput="changenewContent" value="{{newContentWithIndex}}" type="text" placeholder=" 请输入新的隐患信息" /> <input bindinput="changenewContent" value="{{newContent}}" type="text" 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>
<text>再添加一条</text> <text>再添加一条</text>
</view> -->
</view> </view>
</view> <view class="prosecutors" wx:if="{{checkResultFlagRouter == 1}}">
<view class="prosecutors" >
<text class="prosecutors_req">*</text> <text class="prosecutors_req">*</text>
<view class="nes"> <view class="nes">
<view class="conclusion"> <view class="conclusion">
<text class="prosecutors_pre">检查结论</text> <text class="prosecutors_pre">整改要求</text>
<picker class="prosecutors_name" bindchange="pickerChange" value="{{checkResultFlag}}" range="{{array}}"> <input type="text" placeholder="请填写整改要求" bindinput="changenewHazardStatus2" value="{{hazardStatus2}}" style="margin-left: 10rpx;"/>
<view class="{{checkResultFlagName?'':'gray'}}">
{{checkResultFlagName?checkResultFlagName:'请选择'}}
</view>
</picker>
</view> </view>
<view class="conclusion_right"> <view class="conclusion_right">
<image src="../../../../images/right.png" class="prosecutors_img"></image> </view>
</view></view> </view>
</view> </view>
<view class="prosecutors" > <view class="prosecutors" wx:if="{{checkResultFlag == 0}}">
<text class="prosecutors_req" wx:if="{{checkResultFlag == 0}}">*</text> <text class="prosecutors_req">*</text>
<view class="nes"> <view class="nes" bind:tap="handelShowTime">
<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="{{currentDateShow?'prosecutors_name':'gray'}}">
<view class="{{reviewTime?'':'gray'}}"> {{currentDateShow?currentDateShow:'请选择'}}
{{reviewTime?reviewTime:'请选择'}}
</view> </view>
</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>
@ -100,7 +108,7 @@
<view class="text2"> <view class="text2">
巡查记录 巡查记录
</view> </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="item-dian {{index!=0?'item-dian1':''}}">
<view class="neidian"></view> <view class="neidian"></view>
</view> </view>
@ -110,24 +118,28 @@
<view class="logs-content"> <view class="logs-content">
<view class="logs-content-left"> <view class="logs-content-left">
<view> <view>
<text class="logs-content-title">检人员:</text> <text class="logs-content-title">检人员:</text>
<text class="logs-content-txt">{{item.chekPersons||'--'}}</text> <text class="logs-content-txt">{{item.checkPersons||'--'}}</text>
</view> </view>
<view> <view>
<text class="logs-content-title">检查结论:</text> <text class="logs-content-title">检查结论:</text>
<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.hiddenDangeList0}}">{{index + 1}}.{{item.hazardDesc}}</text>
</view> </view>
<view> <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-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>
<view> <view >
<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>
<view> <view>
<text class="logs-content-title">附件:</text> <text class="logs-content-title">附件:</text>
@ -163,3 +175,13 @@
</view> </view>
</van-popup> </van-popup>
<wux-actionsheet id="wux-actionsheet" /> <wux-actionsheet id="wux-actionsheet" />
<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:confirm="handelConfirmDate"
bind:input="onInput"
/>
</van-popup>

1
subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxss

@ -134,6 +134,7 @@ page {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin: 20rpx; margin: 20rpx;
padding-left: 40rpx;
} }
.image1{ .image1{
margin-top: 20rpx; margin-top: 20rpx;

5
subpages/securityCheck/pages/securityCheck.js

@ -20,7 +20,6 @@ Page({
}, },
onLoad(options) { onLoad(options) {
this.getList() this.getList()
}, },
@ -133,7 +132,7 @@ onScrollToLower(e){
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow() {
this.getList()
}, },
@ -176,7 +175,7 @@ onScrollToLower(e){
toDetails(e){ toDetails(e){
console.log(e) console.log(e)
wx.navigateTo({ 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}&name=${e.currentTarget.dataset.name}`,
}) })
} }

4
subpages/securityCheck/pages/securityCheck.wxml

@ -12,7 +12,7 @@
<view class="section_5"> <view class="section_5">
<scroll-view scroll-y="{{true}}" scroll-into-view="scrollToHere" wx:if="{{waitingCheckStyle}}" style="width: 100%; height: 90vh;" <scroll-view scroll-y="{{true}}" scroll-into-view="scrollToHere" wx:if="{{waitingCheckStyle}}" style="width: 100%; height: 90vh;"
lower-threshold="{{ lowerThreshold }}" bindscrolltolower="onScrollToLower"> 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="section_1-0" id="scrollToHere">
<view class="title">{{item.name}}</view> <view class="title">{{item.name}}</view>
<view class="title_mall">检查时间: {{item.orderDate}}</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"> <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="section_1-0" id="scrollToHere" >
<view class="title">{{item.name}}</view> <view class="title">{{item.name}}</view>
<view class="title_mall">检查时间: {{item.orderDate}}</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); 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