diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js
index 8bdee90..07849e8 100644
--- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js
+++ b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js
@@ -15,8 +15,7 @@ Page({
* 页面的初始数据
*/
data: {
- hiddenDangeList: [
- ],
+ hiddenDangeList: [],
newObj:[],
addRecord: [],
attachmentUrl: '',
@@ -37,14 +36,12 @@ Page({
happenTime: "",
content: "", //内容
address: "", //地址
- namesArray: [],
- AllnamesArray: [],
checkPersons: ''
},
imageUrl: '',
remarks: '', //备注
getData: '',
- gridName: '',
+ checkResultName: '',
array: ['不合格', '合格'], // 选择器的数据源
arrlist: [],
fileList: [],
@@ -55,24 +52,17 @@ Page({
// 用于存放复选框选择的结果
result: [],
// 用于存放输入框的值
- newPassword: '',
+ hazardDesc: '',
+ hazardDesc2:'',
uploadImageList: [],
imageId: 1,
- arr: [
- // {value:"1",name:'小王'},
- // {value:"2",name:'李四'},
- // {value:"3",name:'张三'}
- ],
- arr1: [
- // {value:"1",name:'1.车间一些软件设备出现生锈断裂情况严重'},
- // {value:"2",name:'2.还有部分货运车辆已过年检。'},
- ],
+ arr: [],
+ arr1: [],
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
- console.log(options.resiId)
this.setData({
companyId: options.resiId
})
@@ -80,22 +70,67 @@ Page({
key: 'CMJBZ-4DECI-JXGGN-5B4WU-QLV2H-B5BEJ'
})
this.reverseLocation()
- // this.ToaddRecord()
this.getList()
},
-
+ getCurrentDateTime() {
+ const now = new Date();
+ const year = now.getFullYear();
+ const month = (now.getMonth() + 1).toString().padStart(2, '0');
+ const day = now.getDate().toString().padStart(2, '0');
+ const hours = now.getHours().toString().padStart(2, '0');
+ const minutes = now.getMinutes().toString().padStart(2, '0');
+ const seconds = now.getSeconds().toString().padStart(2, '0');
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+ },
submitBiao() {
- console.log("122131")
- const currentDate = new Date();
+ if(!this.data.companyId){
+ wx.showToast({
+ title: '请选择企业',
+ icon:'none'
+ })
+ return false
+ }
+ if(this.data.selectedOptions.length === 0){
+ wx.showToast({
+ title: '请选择检查人员',
+ icon:'none'
+ })
+ return false
+ }
+ if(!this.data.checkResultFlag){
+ wx.showToast({
+ title: '请选择检查结论',
+ icon:'none'
+ })
+ return false
+ }
+ if(this.data.checkResultFlag == 0 && !this.data.reviewTime){
+ wx.showToast({
+ title: '请选择拟复查时间',
+ icon:'none'
+ })
+ return false
+ }
+ if(this.data.checkResultFlag == 0 && this.data.hiddenDangeList.length<0){
+ 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');
addRecord({
companyId: this.data.companyId,
- checkTime: currentDate,
+ checkTime: this.getCurrentDateTime(),
checkPersonsIdList: this.data.checkPersonsIdList,
checkResultFlag: this.data.checkResultFlag,
- reviewTime: this.data.reviewTime,
- hiddenDangeList: this.data.hiddenDangeList,
- attachmentUrls: this.data.uploadImageList,
- remark: '123'
+ reviewTime:`${this.data.reviewTime} ${hours}:${minutes}:${seconds}`,
+ hiddenDangeList:[...this.data.hiddenDangeList,{hazardStatus:2,hazardDesc:this.data.hazardDesc2}] ,
+ attachmentUrls:this.data.uploadImageList.map(item=>({fileName:item.originFileName,attachmentUrl:item.ossUrl.url})),
+ remark: ''
}).then(({
data
}) => {
@@ -111,24 +146,9 @@ Page({
}).then(({
data
}) => {
- // console.log("123131",data.list)
- this.setData({
- marsi: data.list,
- total: data.total
- })
this.setData({
- 'fmData.AllnamesArray': data.list.map(item => ({
- id: item.id,
- name: item.name
- })),
- 'fmData.namesArray': data.list.map(item => (item.name)),
-
- 'fmData.checkPersons': data.list.map((item, index) => ({
- value: index,
- name: item.checkPersons
- })),
+ companyList: data.list,
});
- // console.log("123131", this.data.fmData.namesArray.map(item => item.name));
});
inspectionStaff({
orgId: App.globalData.user.agencyId,
@@ -142,8 +162,6 @@ Page({
arr: data.staffList
})
});
- ///
-
},
/**
* 生命周期函数--监听页面初次渲染完成
@@ -185,8 +203,6 @@ Page({
this.setData({
result: event.detail
});
-
- // event.detail 为当前输入的值
console.log(this.data.result);
console.log(this.data.hiddenDangeList);
@@ -240,67 +256,55 @@ Page({
confirmSelection() {
// 点击确定按钮后触发,处理选中的复选框项
console.log("选中的项:", this.data.selectedOptions);
-
- const selectedName = this.data.selectedOptions;
+ let names = []
+ this.data.arr.forEach(item=>{
+ if(this.data.selectedOptions.findIndex(itemC=>itemC === item.staffId) != -1){
+ names.push(item.name)
+ }
+ })
this.setData({
showPopup: false,
- selectedNames: selectedName
- });
- const matchedStaffIds = [];
- this.data.arr.forEach(item => {
- if (selectedName.includes(item.name)) {
- matchedStaffIds.push(item.staffId);
- }
+ selectedNames: names,
+ checkPersonsIdList:this.data.selectedOptions
});
+ },
+ changeHazardDesc(e) {
this.setData({
- checkPersonsIdList: matchedStaffIds
+ hazardDesc: e.detail.value
});
- // 关闭弹出层
-
},
- changeNewPassword(e) {
- console.log("执行了")
+ changeHazardDescStatus2(e){
this.setData({
- newPassword: e.detail.value
+ hazardDesc2: e.detail.value
});
- console.log(this.data.newPassword)
},
addAnother() {
let newValue = this.data.arr1.length + 1; // 根据数组长度确定新值
let newArr = this.data.arr1.concat({
value: newValue.toString(),
- name: this.data.newPassword
+ name: this.data.hazardDesc
});
this.setData({
arr1: newArr,
- newPassword: '', // 清空输入框的值
+ hazardDesc: '', // 清空输入框的值
});
const nameArray = this.data.arr1.map(item => item.name);
- console.log("111",nameArray)
nameArray.forEach(value => {
- console.log( "qqq")
// 创建一个新的对象,设置 hazardDesc 属性为当前值
this.data.newObj = {
hazardStatus: '0', // 如果需要同时设置 hazardStatus 属性,可以在这里进行设置
hazardDesc: value
};
- console.log( this.data.newObj)
- // 将新对象添加到 hiddenDangeList 数组中
- console.log(this.data.hiddenDangeList)
});
this.data.hiddenDangeList.push(this.data.newObj);
console.log(this.data.hiddenDangeList)
},
pickerChange: function (e) {
- // 更新当前选中的索引
- console.log(e.detail.value),
this.setData({
- gridName: this.data.array[e.detail.value]
+ checkResultName: this.data.array[e.detail.value],
+ checkResultFlag:e.detail.value
});
- this.data.checkResultFlag = e.detail.value
- console.log(this.data.gridName)
- // 在这里可以根据选择的值进行相应的逻辑处理
},
pickerChange1: function (e) {
// 更新当前选中的索引
@@ -315,9 +319,9 @@ Page({
pickerChange2: function (e) {
// 更新当前选中的索引
this.setData({
- gridNName: this.data.fmData.namesArray[e.detail.value]
+ gridNName: this.data.companyList[e.detail.value].name,
+ companyId:this.data.companyList[e.detail.value].id
});
- this.data.addRecord = this.data.fmData.AllnamesArray[e.detail.value].id
},
bindRemarkInput(e) {
this.setData({
diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml
index 24d2f0f..c7de64c 100644
--- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml
+++ b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml
@@ -16,7 +16,7 @@
*
企业名称
-
+
{{gridNName?gridNName:'请选择'}}
@@ -40,7 +40,7 @@
- *
+ *
隐患明细
@@ -50,7 +50,7 @@
-
+
@@ -72,7 +72,7 @@
-->
-
+
@@ -82,8 +82,8 @@
*
检查结论
-
- {{gridName?gridName:'请选择'}}
+
+ {{checkResultName?checkResultName:'请选择'}}
@@ -93,7 +93,7 @@
- *
+ *
拟复查时间
@@ -121,7 +121,7 @@
wx:key="imageId">
-
+
@@ -142,7 +142,7 @@
diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js
index e891e49..029855f 100644
--- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js
+++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js
@@ -251,7 +251,7 @@ handelClickSave(){
})
return false
}
- if(this.data.checkResultFlag == 0 && this.data.hiddenDangeList.length<0){
+ if(this.data.checkResultFlag == 0 && this.data.checkboxOptions.length<0){
wx.showToast({
title: '请填写隐患明细',
icon:'none'
diff --git a/utils/config.js b/utils/config.js
index cf2c325..dce6c12 100644
--- a/utils/config.js
+++ b/utils/config.js
@@ -5,13 +5,13 @@ module.exports = {
};
function BASEURL() {
- // return 'https://epmet-preview.elinkservice.cn/api/' // 演示环境
+ return 'https://epmet-preview.elinkservice.cn/api/' // 演示环境
// return 'http://192.168.1.144/api/' //测试环境
// return 'http://219.146.91.110:30801/api/'
// return 'https://epmet-preview.elinkservice.cn/api/' // 演示环境
// return 'http://192.168.1.144/api/' //测试环境
- return 'http://219.146.91.110:30801/api/'
+ // return 'http://219.146.91.110:30801/api/'
//return http://219.146.91.110:30801/api //外网
}