Browse Source

新增巡查记录

lisu_V4.3.1
mk 1 year ago
parent
commit
a7d3fea423
  1. 156
      subpages/InspectionReport/pages/InspectionReport/InspectionReport.js
  2. 18
      subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml
  3. 2
      subpages/safetyinspection/pages/safetyinspection/safetyinspection.js
  4. 4
      utils/config.js

156
subpages/InspectionReport/pages/InspectionReport/InspectionReport.js

@ -15,8 +15,7 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
hiddenDangeList: [ hiddenDangeList: [],
],
newObj:[], newObj:[],
addRecord: [], addRecord: [],
attachmentUrl: '', attachmentUrl: '',
@ -37,14 +36,12 @@ Page({
happenTime: "", happenTime: "",
content: "", //内容 content: "", //内容
address: "", //地址 address: "", //地址
namesArray: [],
AllnamesArray: [],
checkPersons: '' checkPersons: ''
}, },
imageUrl: '', imageUrl: '',
remarks: '', //备注 remarks: '', //备注
getData: '', getData: '',
gridName: '', checkResultName: '',
array: ['不合格', '合格'], // 选择器的数据源 array: ['不合格', '合格'], // 选择器的数据源
arrlist: [], arrlist: [],
fileList: [], fileList: [],
@ -55,24 +52,17 @@ Page({
// 用于存放复选框选择的结果 // 用于存放复选框选择的结果
result: [], result: [],
// 用于存放输入框的值 // 用于存放输入框的值
newPassword: '', hazardDesc: '',
hazardDesc2:'',
uploadImageList: [], uploadImageList: [],
imageId: 1, imageId: 1,
arr: [ arr: [],
// {value:"1",name:'小王'}, arr1: [],
// {value:"2",name:'李四'},
// {value:"3",name:'张三'}
],
arr1: [
// {value:"1",name:'1.车间一些软件设备出现生锈断裂情况严重'},
// {value:"2",name:'2.还有部分货运车辆已过年检。'},
],
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
console.log(options.resiId)
this.setData({ this.setData({
companyId: options.resiId companyId: options.resiId
}) })
@ -80,22 +70,67 @@ Page({
key: 'CMJBZ-4DECI-JXGGN-5B4WU-QLV2H-B5BEJ' key: 'CMJBZ-4DECI-JXGGN-5B4WU-QLV2H-B5BEJ'
}) })
this.reverseLocation() this.reverseLocation()
// this.ToaddRecord()
this.getList() 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() { submitBiao() {
console.log("122131") if(!this.data.companyId){
const currentDate = new Date(); 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({ addRecord({
companyId: this.data.companyId, companyId: this.data.companyId,
checkTime: currentDate, checkTime: this.getCurrentDateTime(),
checkPersonsIdList: this.data.checkPersonsIdList, checkPersonsIdList: this.data.checkPersonsIdList,
checkResultFlag: this.data.checkResultFlag, checkResultFlag: this.data.checkResultFlag,
reviewTime: this.data.reviewTime, reviewTime:`${this.data.reviewTime} ${hours}:${minutes}:${seconds}`,
hiddenDangeList: this.data.hiddenDangeList, hiddenDangeList:[...this.data.hiddenDangeList,{hazardStatus:2,hazardDesc:this.data.hazardDesc2}] ,
attachmentUrls: this.data.uploadImageList, attachmentUrls:this.data.uploadImageList.map(item=>({fileName:item.originFileName,attachmentUrl:item.ossUrl.url})),
remark: '123' remark: ''
}).then(({ }).then(({
data data
}) => { }) => {
@ -111,24 +146,9 @@ Page({
}).then(({ }).then(({
data data
}) => { }) => {
// console.log("123131",data.list)
this.setData({
marsi: data.list,
total: data.total
})
this.setData({ this.setData({
'fmData.AllnamesArray': data.list.map(item => ({ companyList: data.list,
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
})),
}); });
// console.log("123131", this.data.fmData.namesArray.map(item => item.name));
}); });
inspectionStaff({ inspectionStaff({
orgId: App.globalData.user.agencyId, orgId: App.globalData.user.agencyId,
@ -142,8 +162,6 @@ Page({
arr: data.staffList arr: data.staffList
}) })
}); });
///
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
@ -185,8 +203,6 @@ Page({
this.setData({ this.setData({
result: event.detail result: event.detail
}); });
// event.detail 为当前输入的值
console.log(this.data.result); console.log(this.data.result);
console.log(this.data.hiddenDangeList); console.log(this.data.hiddenDangeList);
@ -240,67 +256,55 @@ Page({
confirmSelection() { confirmSelection() {
// 点击确定按钮后触发,处理选中的复选框项 // 点击确定按钮后触发,处理选中的复选框项
console.log("选中的项:", this.data.selectedOptions); console.log("选中的项:", this.data.selectedOptions);
let names = []
const selectedName = this.data.selectedOptions; this.data.arr.forEach(item=>{
if(this.data.selectedOptions.findIndex(itemC=>itemC === item.staffId) != -1){
names.push(item.name)
}
})
this.setData({ this.setData({
showPopup: false, showPopup: false,
selectedNames: selectedName selectedNames: names,
}); checkPersonsIdList:this.data.selectedOptions
const matchedStaffIds = [];
this.data.arr.forEach(item => {
if (selectedName.includes(item.name)) {
matchedStaffIds.push(item.staffId);
}
}); });
},
changeHazardDesc(e) {
this.setData({ this.setData({
checkPersonsIdList: matchedStaffIds hazardDesc: e.detail.value
}); });
// 关闭弹出层
}, },
changeNewPassword(e) { changeHazardDescStatus2(e){
console.log("执行了")
this.setData({ this.setData({
newPassword: e.detail.value hazardDesc2: e.detail.value
}); });
console.log(this.data.newPassword)
}, },
addAnother() { addAnother() {
let newValue = this.data.arr1.length + 1; // 根据数组长度确定新值 let newValue = this.data.arr1.length + 1; // 根据数组长度确定新值
let newArr = this.data.arr1.concat({ let newArr = this.data.arr1.concat({
value: newValue.toString(), value: newValue.toString(),
name: this.data.newPassword name: this.data.hazardDesc
}); });
this.setData({ this.setData({
arr1: newArr, arr1: newArr,
newPassword: '', // 清空输入框的值 hazardDesc: '', // 清空输入框的值
}); });
const nameArray = this.data.arr1.map(item => item.name); const nameArray = this.data.arr1.map(item => item.name);
console.log("111",nameArray)
nameArray.forEach(value => { nameArray.forEach(value => {
console.log( "qqq")
// 创建一个新的对象,设置 hazardDesc 属性为当前值 // 创建一个新的对象,设置 hazardDesc 属性为当前值
this.data.newObj = { this.data.newObj = {
hazardStatus: '0', // 如果需要同时设置 hazardStatus 属性,可以在这里进行设置 hazardStatus: '0', // 如果需要同时设置 hazardStatus 属性,可以在这里进行设置
hazardDesc: value hazardDesc: value
}; };
console.log( this.data.newObj)
// 将新对象添加到 hiddenDangeList 数组中
console.log(this.data.hiddenDangeList)
}); });
this.data.hiddenDangeList.push(this.data.newObj); this.data.hiddenDangeList.push(this.data.newObj);
console.log(this.data.hiddenDangeList) console.log(this.data.hiddenDangeList)
}, },
pickerChange: function (e) { pickerChange: function (e) {
// 更新当前选中的索引
console.log(e.detail.value),
this.setData({ 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) { pickerChange1: function (e) {
// 更新当前选中的索引 // 更新当前选中的索引
@ -315,9 +319,9 @@ Page({
pickerChange2: function (e) { pickerChange2: function (e) {
// 更新当前选中的索引 // 更新当前选中的索引
this.setData({ 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) { bindRemarkInput(e) {
this.setData({ this.setData({

18
subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml

@ -16,7 +16,7 @@
<view class="conclusion"> <view class="conclusion">
<text class="prosecutors_req">*</text> <text class="prosecutors_req">*</text>
<text class="prosecutors_pre">企业名称</text> <text class="prosecutors_pre">企业名称</text>
<picker class="prosecutors_name" bindchange="pickerChange2" value="{{index}}" range="{{fmData.namesArray}}"> <picker class="prosecutors_name" bindchange="pickerChange2" range-key="name" value="{{index}}" range="{{companyList}}">
<view class="{{gridNName?'':'gray'}}"> <view class="{{gridNName?'':'gray'}}">
{{gridNName?gridNName:'请选择'}} {{gridNName?gridNName:'请选择'}}
</view> </view>
@ -40,7 +40,7 @@
<view class="pitfall"> <view class="pitfall">
<view class="prosecutors"> <view class="prosecutors">
<view> <view>
<text class="prosecutors_req">*</text> <text class="prosecutors_req" wx:if="{{checkResultFlag == 0}}">*</text>
<text class="prosecutors_pre">隐患明细</text> <text class="prosecutors_pre">隐患明细</text>
</view> </view>
</view> </view>
@ -50,7 +50,7 @@
</van-checkbox-group> </van-checkbox-group>
</view> </view>
<view class="input1"> <view class="input1">
<input bindinput="changeNewPassword" type="text" placeholder=" 请输入" /> <input bindinput="changeHazardDesc" type="text" value="{{hazardDesc}}" 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>
@ -72,7 +72,7 @@
</van-checkbox-group> </van-checkbox-group>
</view> --> </view> -->
<view class="input1"> <view class="input1">
<input bindinput="changeHazardDesc" type="text" placeholder="请输入" value="{{ hazardDesc }}" /> <input bindinput="changeHazardDescStatus2" type="text" placeholder="请输入" value="{{ hazardDesc2 }}" />
</view> </view>
</view> </view>
@ -82,8 +82,8 @@
<text class="prosecutors_req">*</text> <text class="prosecutors_req">*</text>
<text class="prosecutors_pre">检查结论</text> <text class="prosecutors_pre">检查结论</text>
<picker class="prosecutors_name" bindchange="pickerChange" value="{{index}}" range="{{array}}"> <picker class="prosecutors_name" bindchange="pickerChange" value="{{index}}" range="{{array}}">
<view class="{{gridName?'':'gray'}}"> <view class="{{checkResultName?'':'gray'}}">
{{gridName?gridName:'请选择'}} {{checkResultName?checkResultName:'请选择'}}
</view> </view>
</picker> </picker>
</view> </view>
@ -93,7 +93,7 @@
</view> </view>
<view class="prosecutors"> <view class="prosecutors">
<view class="prosecutors_data"> <view class="prosecutors_data">
<text class="prosecutors_req">*</text> <text class="prosecutors_req" wx:if="{{checkResultFlag == 0}}">*</text>
<text class="prosecutors_pre">拟复查时间</text> <text class="prosecutors_pre">拟复查时间</text>
<view> <view>
<picker mode="date" class="prosecutors_name" bindchange="pickerChange1" value="{{data}}"> <picker mode="date" class="prosecutors_name" bindchange="pickerChange1" value="{{data}}">
@ -121,7 +121,7 @@
wx:key="imageId"> wx:key="imageId">
<image class="issue-image" src="{{item.ossUrl.url}}" /> <image class="issue-image" src="{{item.ossUrl.url}}" />
<image wx:if="{{!item.uploaded}}" class="loading" src="../../../../images/loading.gif" /> <image wx:if="{{!item.uploaded}}" class="loading" src="../../../../images/loading.gif" />
<image bindtap="deleteImage" data-imageid="{{item.imageId}}" class="close" wx:else src="../../../../images/loading.gif" /> <image bindtap="deleteImage" data-imageid="{{item.imageId}}" class="close" wx:else src="../../../../images/icon_close.png" />
</view> </view>
<image wx:if="{{uploadImageList.length < 3}}" src="../../../../images/addphoto.png" bindtap="chooseImage" /> <image wx:if="{{uploadImageList.length < 3}}" src="../../../../images/addphoto.png" bindtap="chooseImage" />
</view> </view>
@ -142,7 +142,7 @@
<van-popup show="{{ showPopup }}" closeable close-icon="close" position="bottom" custom-style="height: 50%" bind:close="onClose"> <van-popup show="{{ showPopup }}" closeable close-icon="close" position="bottom" custom-style="height: 50%" bind:close="onClose">
<view class="popup-content"> <view class="popup-content">
<van-checkbox-group value="{{selectedOptions}}" bind:change="onChange1"> <van-checkbox-group value="{{selectedOptions}}" bind:change="onChange1">
<van-checkbox name="{{item.name}}" data-value="{{item.value}}" wx:for="{{arr}}">{{item.name}}</van-checkbox> <van-checkbox name="{{item.staffId}}" wx:for="{{arr}}">{{item.name}}</van-checkbox>
</van-checkbox-group> </van-checkbox-group>
<button bindtap="confirmSelection">确定</button> <button bindtap="confirmSelection">确定</button>
</view> </view>

2
subpages/safetyinspection/pages/safetyinspection/safetyinspection.js

@ -251,7 +251,7 @@ handelClickSave(){
}) })
return false return false
} }
if(this.data.checkResultFlag == 0 && this.data.hiddenDangeList.length<0){ if(this.data.checkResultFlag == 0 && this.data.checkboxOptions.length<0){
wx.showToast({ wx.showToast({
title: '请填写隐患明细', title: '请填写隐患明细',
icon:'none' icon:'none'

4
utils/config.js

@ -5,13 +5,13 @@ module.exports = {
}; };
function BASEURL() { 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://192.168.1.144/api/' //测试环境
// return 'http://219.146.91.110:30801/api/' // return 'http://219.146.91.110:30801/api/'
// return 'https://epmet-preview.elinkservice.cn/api/' // 演示环境 // return 'https://epmet-preview.elinkservice.cn/api/' // 演示环境
// return 'http://192.168.1.144/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 //外网 //return http://219.146.91.110:30801/api //外网
} }

Loading…
Cancel
Save