Commit 976ba0b6 authored by xinzhedeai's avatar xinzhedeai

小程序端 隐患新增校验添加 编辑字段与新增保持一致 审查界面完善

parent 6727dc0f
...@@ -51,7 +51,28 @@ Page({ ...@@ -51,7 +51,28 @@ Page({
topAnimation: {}, topAnimation: {},
curRole:'', curRole:'',
isToEnLarge: false, isToEnLarge: false,
xcx:'xcx' xcx:'xcx',
// 总的安全类别
secType: [
{
name: '安全资料类'
},
{
name: '现场检查类'
}
],
//
curSelectSecType: '',
// 安全检查类别
secCheckType: [],
// 安全检查类别替代
secCheckTypeReplace: [],
// 当前选择的安全检查类别
curSelectSecCheckTypeReplace: '',
// 安全检查内容
secCheckContent: [],
// 当前选择的安全检查内容
curSelectCheckContent: '',
}, },
/** /**
...@@ -62,6 +83,9 @@ Page({ ...@@ -62,6 +83,9 @@ Page({
this.setData({ this.setData({
curRole: app.globalData.curRole curRole: app.globalData.curRole
}) })
const animation = wx.createAnimation({ const animation = wx.createAnimation({
delay: 10, delay: 10,
timingFunction: 'linear' timingFunction: 'linear'
...@@ -71,6 +95,15 @@ Page({ ...@@ -71,6 +95,15 @@ Page({
this.setData( this.setData(
app.globalData.currentHD app.globalData.currentHD
) )
console.log('app.globalData.currentHD',app.globalData.currentHD)
// 设置回显数据
this.setData({
curSelectSecType: app.globalData.currentHD.type, // 安全类别
curSelectSecCheckTypeReplace: app.globalData.currentHD.category, // 安全检查类别
curSelectCheckContent: app.globalData.currentHD.inspectionContent, // 安全检查内容
hdName: app.globalData.currentHD.hdName, // 安全发现问题
editAble: app.globalData.currentHD.hdStatus===0 || app.globalData.currentHD.hdStatus===2,
})
// console.log(app.globalData.currentHD, 'currentHD') // console.log(app.globalData.currentHD, 'currentHD')
// 调用接口 获取图片 // 调用接口 获取图片
wx.request({ wx.request({
...@@ -90,7 +123,7 @@ Page({ ...@@ -90,7 +123,7 @@ Page({
Authorization: app.globalData.Authorization Authorization: app.globalData.Authorization
}, },
success: (res) => { success: (res) => {
if (res.statusCode === 401) { if (res.status === 401) {
wx.redirectTo({ wx.redirectTo({
url: '/pages/login/login', url: '/pages/login/login',
}) })
...@@ -178,10 +211,188 @@ Page({ ...@@ -178,10 +211,188 @@ Page({
onShareAppMessage: function () { onShareAppMessage: function () {
}, },
// 选择检查日期
selectCheckDate(event) {
this.setData({
hdInspectDate: event.detail.value
})
},
// 输入检查专家
inputHdInspectExpert(event) {
this.data.hdInspectExpert = event.detail.value
},
//
inputHdComment(event) {
console.log(event,'event.....')
if(event.detail.value!=''||event.detail.value!=null){
this.data.comment = event.detail.value
}
},
//安全类别
chooseSecType(e){
let that=this;
that.setData({
// 安全检查类别替代
secCheckTypeReplace: [],
// 当前选择的安全检查类别
curSelectSecCheckTypeReplace: '',
// 安全检查内容
secCheckContent: [],
// 当前选择的安全检查内容
curSelectCheckContent: '',
// 发现问题
secCheckDiscover: [],
// 隐患名称
hdName: '',
})
wx.request({
url: app.globalData.appBaseUrl + '/api/enterpriseSafetyInspectionContent',
method: 'get',
header: {
Authorization: app.globalData.Authorization
},
data: {
county:app.globalData.appCounty,
level: 1,
type: that.data.secType[e.detail.value].name,
page: 0,
size: 99999,
},
success: (res) => {
this.setData({
secCheckTypeReplace: [...res.data.content],
curSelectSecType: that.data.secType[e.detail.value].name
})
}
})
},
//安全检查类别
chooseSecCheckType(event) {
let that = this;
that.setData({
// 安全检查内容
secCheckContent: [],
// 当前选择的安全检查内容
curSelectCheckContent: '',
// 发现问题
secCheckDiscover: [],
// 隐患名称
hdName: '',
})
wx.request({
url: app.globalData.appBaseUrl + '/api/enterpriseSafetyInspectionContent',
method: 'get',
header: {
Authorization: app.globalData.Authorization
},
data: {
county:app.globalData.appCounty,
level: 2,
page: 0,
size: 9999,
pid: that.data.secCheckTypeReplace[event.detail.value].id
},
success: (res) => {
this.setData({
secCheckContent: [...res.data.content],
curSelectSecCheckTypeReplace: that.data.secCheckTypeReplace[event.detail.value].name
})
}
})
},
//安全检查内容
chooseSecCheckContent(event) {
let that=this;
that.setData({
// 发现问题
secCheckDiscover: [],
// 隐患名称
hdName: '',
})
wx.request({
url: app.globalData.appBaseUrl + '/api/enterpriseSafetyMatter',
method: 'get',
header: {
Authorization: app.globalData.Authorization
},
data: {
inspectionContentId: this.data.secCheckContent[event.detail.value].id,
page: 0,
size: 9999
},
success: (res) => {
this.setData({
secCheckDiscover: res.data.content,
curSelectCheckContent: this.data.secCheckContent[event.detail.value].name
})
}
})
},
chooseSecCheckDiscover(event) {
this.data.hdName = this.data.secCheckDiscover[event.detail.value].name
this.setData({
hdName: this.data.hdName,
basis: this.data.secCheckDiscover[event.detail.value].basis,
suggestion: this.data.secCheckDiscover[event.detail.value].suggestion
})
},
// 输入隐患名称
inputHdName(event) {
this.data.hdName = event.detail.value
},
// 输入隐患类型
inputHDType(event) {
console.log(event, 'hdTypeInput')
this.data.hdLevel = event.detail.value
},
// 输入检查依据
inpoutBasis(event) {
this.data.basis = event.detail.value
},
// 输入整改建议
inputRectSug(event) {
// this.data.hdRectificationSug = event.detail.value
this.data.suggestion = event.detail.value
},
// 输入整改评价 // 输入整改评价
inputEvaluation(event) { inputEvaluation(event) {
this.data.recEvaluation = event.detail.value this.data.recEvaluation = event.detail.value
},
// 输入整改期限
inputRectification(event) {
this.setData({
recDeadLine: event.detail.value
})
},
// 输入整改日期
inputRectDate(event) {
this.setData({
hdRectificationDate: event.detail.value
})
},
// 输入验收人
inputHdAcceptancePerson(event) {
this.data.hdAcceptancePerson = event.detail.value
}, },
/**
* 拍摄整改照片
*/
/** /**
* 拍摄隐患图片 * 拍摄隐患图片
*/ */
...@@ -213,36 +424,6 @@ Page({ ...@@ -213,36 +424,6 @@ Page({
} }
}) })
}, },
// /**
// * 拍摄整改照片
// */
// takePhoto() {
// wx.chooseImage({
// success: (res) => {
// if(res.tempFilePaths[0]){
// this.setData({
// checkImg: true
// })
// }else{
// this.setData({
// checkImg: false
// })
// }
// console.log(res.tempFilePaths[0],'res.tempFilePaths[0]',this.data.checkImg)
// this.data.rectFilePath = res.tempFilePaths[0]
// wx.getFileSystemManager().readFile({
// filePath: res.tempFilePaths[0], // 选择图片返回的相对路径
// encoding: 'base64', // 编码格式
// success: res1 => { // 成功的回调
// this.setData({
// imgrecturl: 'data:image/png;base64,' + res1.data
// })
// }
// })
// }
// })
// },
/** /**
* 输入整改日期 * 输入整改日期
*/ */
...@@ -331,9 +512,9 @@ Page({ ...@@ -331,9 +512,9 @@ Page({
success: (res) => { success: (res) => {
console.log(res, '文件编辑上传') console.log(res, '文件编辑上传')
wx.hideLoading() wx.hideLoading()
if (res.status === 201) { if (res.status === 200) {
wx.showToast({ wx.showToast({
title: '编辑成功', title: '操作成功',
icon: 'success' icon: 'success'
}) })
wx.navigateBack() wx.navigateBack()
...@@ -405,8 +586,7 @@ Page({ ...@@ -405,8 +586,7 @@ Page({
}, },
data: this.formatFormData(formData), data: this.formatFormData(formData),
success: (res) => { success: (res) => {
console.log(res, '上传成功了吗afhdhsfhhdsfhadsf') if(res.status===200){
if(res.statusCode===204){
wx.showToast({ wx.showToast({
title: '编辑成功', title: '编辑成功',
icon: 'success', icon: 'success',
...@@ -416,7 +596,7 @@ Page({ ...@@ -416,7 +596,7 @@ Page({
wx.navigateBack() wx.navigateBack()
}, 2000); }, 2000);
}else if(res.statusCode===400){ }else if(res.status===400){
wx.showToast({ wx.showToast({
title: res.data.message, title: res.data.message,
icon: 'error', icon: 'error',
......
<!--pages/dangeredit/dangeredit.wxml--> <!--pages/dangeredit/dangeredit.wxml-->
<view class="danger-edit-wrapper"> <view class="danger-edit-wrapper">
<scroll-view <scroll-view scroll-y="true" class="danger-form-wrapper">
scroll-y="true"
class="danger-form-wrapper">
<!-- <view class="danger-order"> <!-- <view class="danger-order">
<text>序号:</text> <text>序号:</text>
<input type="text" disabled="{{!editAble}}" /> <input type="text" disabled="{{!editAble}}" />
</view> --> </view> -->
<view class="danger-check-date"> <view class="danger-check-date">
<text>检查日期:</text> <text>检查日期:</text>
<picker class="danger-pick-date" disabled="{{!editAble}}" mode="date" value="{{hdInspectDate}}" bindchange=""> <picker class="danger-pick-date" disabled="{{!editAble}}" mode="date" value="{{hdInspectDate}}" bindchange="selectCheckDate">
<view class="current-picker"> <view class="current-picker">
当前选择: {{hdInspectDate}} 当前选择: {{hdInspectDate}}
</view> </view>
...@@ -18,28 +16,78 @@ ...@@ -18,28 +16,78 @@
<view class="danger-expert"> <view class="danger-expert">
<text>检查人员:</text> <text>检查人员:</text>
<input type="text" disabled="{{!editAble}}" placeholder="请输入人员名称" value="{{hdInspectExpert}}" bindinput="" /> <input type="text" disabled="{{!editAble}}" placeholder="请输入人员名称" value="{{hdInspectExpert}}" bindinput="inputHdInspectExpert" />
</view> </view>
<view class="danger-type"> <view class="danger-type">
<text>隐患类型:</text> <text>隐患等级:</text>
<radio-group bindchange=""> <radio-group bindchange="inputHDType">
<radio color="#1d2089" disabled="{{!editAble}}" checked="{{hdLevel===1}}" value="1" >一般隐患</radio> <radio color="#1d2089" disabled="{{!editAble}}" checked="{{hdLevel===1}}" value="1">一般隐患</radio>
<radio color="#1d2089" disabled="{{!editAble}}" checked="{{hdLevel===2}}" value="2" >重大隐患</radio> <radio color="#1d2089" disabled="{{!editAble}}" checked="{{hdLevel===2}}" value="2">重大隐患</radio>
</radio-group> </radio-group>
</view> </view>
<block wx:if="{{comment==''||comment==null}}"> <view class="c11-1">
<view class="danger-name"> <text>安全类别:</text>
<text style="width:200rpx ;">隐患名称:</text> <view>
<textarea type="text" disabled="{{!editAble}}" placeholder="请输入隐患名称" value="{{hdName}}" bindinput="" maxlength="-1" /> <picker
header-text="安全类别"
mode="selector"
range="{{secType}}"
range-key="name"
bindchange="chooseSecType"
>
当前选择: {{curSelectSecType}}
</picker>
</view>
</view>
<view class="c11-1">
<text>安全检查类别</text>
<view>
<picker
header-text="安全检查类别"
mode="selector"
range="{{secCheckTypeReplace}}"
range-key="name"
bindchange="chooseSecCheckType"
>
当前选择: {{curSelectSecCheckTypeReplace}}
</picker>
</view>
</view>
<view class="c11-1">
<text>安全检查内容</text>
<view>
<picker
header-text="安全检查内容"
mode="selector"
range="{{secCheckContent}}"
range-key="name"
bindchange="chooseSecCheckContent"
>当前选择: {{curSelectCheckContent}}</picker>
</view>
</view>
<view class="c11-1">
<text>发现问题</text>
<view>
<picker
header-text="发现问题"
mode="selector"
range="{{secCheckDiscover}}"
range-key="name"
bindchange="chooseSecCheckDiscover"
>当前选择:{{hdName}}</picker>
</view>
</view> </view>
</block>
<view class="danger-expert"> <view class="danger-expert">
<text style="width:200rpx ;">隐患描述: </text> <text style="width:200rpx ;">隐患描述: </text>
<textarea type="text" disabled="{{!editAble}}" placeholder="请输入隐患描述" value="{{comment}}" bindinput="" maxlength="-1" /> <input type="text" disabled="{{!editAble}}" value="{{comment}}" bindinput="inputHdComment" maxlength="-1" />
</view> </view>
<view class="danger-expert"> <view class="danger-expert">
<text style="width:200rpx ;">检查依据: </text> <text style="width:200rpx ;">检查依据: </text>
<textarea type="text" disabled="{{!editAble}}" placeholder="请输入检查依据" value="{{basis}}" bindinput="" maxlength="-1" /> <textarea type="text" value="{{basis}}" bindinput="" maxlength="-1" />
</view> </view>
<view class="danger-rect"> <view class="danger-rect">
<text>整改建议:</text> <text>整改建议:</text>
...@@ -47,39 +95,25 @@ ...@@ -47,39 +95,25 @@
<textarea wx:else="{{suggestion==''}}" disabled="{{!editAble}}" maxlength="-1" bindinput="" value="{{hdRectificationSug}}"></textarea> <textarea wx:else="{{suggestion==''}}" disabled="{{!editAble}}" maxlength="-1" bindinput="" value="{{hdRectificationSug}}"></textarea>
</view> </view>
<!-- <view class="hdPic-preview"> <view class="hdPic-preview">
<text>隐患照片预览:</text> <text>隐患照片:</text>
<image mode="aspectFit" src="{{imgsrcurl}}" <image mode="aspectFit" src="{{imgsrcurl}}" bindtap="toEnlargePicByHiddenPic"></image>
bindtap="toEnlargePicByHiddenPic"></image>
</view> -->
<view class="danger-img">
<text>隐患照片</text>
<!-- <camera device-position="back" flash="off" style="width:100%;height:300px;"></camera> -->
<image mode="aspectFit" src="{{imgsrcurl}}"></image>
<button wx:if="{{editAble}}" type="primary" bindtap="takePhoto" style="background-color: #1d2089;">拍照</button> <button wx:if="{{editAble}}" type="primary" bindtap="takePhoto" style="background-color: #1d2089;">拍照</button>
</view> </view>
<view class="danger-img"> <view class="danger-img">
<text>整改照片</text> <text>整改照片</text>
<!-- <camera device-position="back" flash="off" style="width:100%;height:300px;"></camera> --> <!-- <camera device-position="back" flash="off" style="width:100%;height:300px;"></camera> -->
<image mode="aspectFit" src="{{imgrecturl}}" bindtap="toEnlargePicByRectPic"></image> <image mode="aspectFit" src="{{imgrecturl}}" bindtap="toEnlargePicByRectPic"></image>
</view> </view>
<view class="danger-rect-date" > <view class="danger-rect-date">
<text>整改期限:</text> <text>整改期限:</text>
<picker wx:if="{{(curRole=='政府')}}" class="danger-pick-date" mode="date" bindchange="inputRectification" value="{{recDeadLine}}"> <picker class="danger-pick-date" mode="date" bindchange="inputRectification" value="{{recDeadLine}}">
<view class="current-picker">
当前选择: {{recDeadLine ? recDeadLine : ''}}
</view>
</picker>
<picker wx:if="{{(curRole!=='政府')}}" class="danger-pick-date" mode="date" bindchange="inputRectification" value="{{recDeadLine}}">
<view class="current-picker"> <view class="current-picker">
当前选择: {{recDeadLine ? recDeadLine : ''}} 当前选择: {{recDeadLine ? recDeadLine : ''}}
</view> </view>
</picker> </picker>
</view> </view>
<view class="danger-rect-date" wx:if="{{!showButton}}"> <view class="danger-rect-date">
<text>复查日期:</text> <text>复查日期:</text>
<picker class="danger-pick-date" disabled="true" mode="date" bindchange="inputRectDate" value="{{hdRectificationDate}}"> <picker class="danger-pick-date" disabled="true" mode="date" bindchange="inputRectDate" value="{{hdRectificationDate}}">
<view class="current-picker"> <view class="current-picker">
...@@ -89,39 +123,17 @@ ...@@ -89,39 +123,17 @@
</view> </view>
<view class="danger-recept-per"> <view class="danger-recept-per">
<text>复查人员:</text> <text>复查人员:</text>
<input type="text" placeholder="请输入验收人" value="{{hdAcceptancePerson}}" disabled="true" bindinput="inputAcceptancePer" /> <input type="text" value="{{hdAcceptancePerson}}" disabled="true" bindinput="inputAcceptancePer" />
</view> </view>
<view class="danger-rect" > <view class="danger-rect">
<text>复查记录:</text> <text>复查记录:</text>
<textarea disabled="true" maxlength="-1" bindinput="" value="{{recEvaluation}}"></textarea> <textarea disabled="true" maxlength="-1" bindinput="" value="{{recEvaluation}}"></textarea>
</view> </view>
<!-- <view class="rect-img">
<text>整改照片</text>
<button type="primary" bindtap="takePhoto2">拍照</button>
</view>
<view class="rect-preview">
<text>整改照片预览:</text>
<image mode="widthFix" src="{{imgrecturl}}"></image>
</view> -->
<!-- <view class="danger-status" wx:if="{{checkImg===true}}"> -->
<!-- <view class="danger-status" >
<text>隐患状态:</text>
<radio-group bindchange="inputRectStatus">
<radio checked="{{hdStatus===0}}" value="0" color="#1d2089">未整改</radio>
<radio checked="{{hdStatus===1}}" value="1" color="#1d2089" >整改完成</radio>
</radio-group>
</view> -->
<view class="danger-submit" wx:if="{{editAble}}"> <view class="danger-submit" wx:if="{{editAble}}">
<button type="primary" bindtap="submitEdit" style="background-color: #1d2089;" >提交修改</button> <button type="primary" bindtap="submitEdit" style="background-color: #1d2089;">提交修改</button>
</view> </view>
</scroll-view> </scroll-view>
<view class="enlarge-pic-wrapper {{isToEnLarge? 'enlarge-pic-show': ''}}"> <view class="enlarge-pic-wrapper {{isToEnLarge? 'enlarge-pic-show': ''}}">
<image <image src="{{enlargeUrl}}" mode="aspectFit" class="enlarge-pic" bindtap="toCancelEnlargePic"></image>
src="{{enlargeUrl}}"
mode="aspectFit"
class="enlarge-pic"
bindtap="toCancelEnlargePic"
></image>
</view> </view>
</view> </view>
\ No newline at end of file
...@@ -178,3 +178,171 @@ ...@@ -178,3 +178,171 @@
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
} }
/* pages/dangerregister/dangerregister.wxss */
.danger-register-wrapper {
width: 100%;
height: 100%;
}
.danger-form-wrapper {
width: 100vw;
margin: 0 auto;
/* background-color: #eee; */
padding-top: 2vh;
padding-bottom: 2vh;
}
.danger-order {
display: flex;
margin: 3vh 2vw;
background-color: white;
padding: 1vh 1vw;
}
.danger-order text {
flex-grow: 0;
flex-shrink: 0;
}
.danger-order input {
flex-grow: 1;
flex-shrink: 0;
}
.danger-check-date {
display: flex;
background-color: white;
margin: 3vh 5vw;
justify-content: space-between;
padding: 1vh 2vw;
border-radius: 5px;
box-shadow: 1rpx 1rpx 0.5rpx 0.5rpx #eee, -1rpx -1rpx 0.5rpx 0.5rpx #eee;
}
.danger-check-date .danger-pick-date {
flex: 1;
text-align: right;
}
.danger-expert {
display: flex;
background-color: white;
margin: 3vh 5vw;
justify-content: space-between;
padding: 1vh 2vw;
border-radius: 5px;
box-shadow: 1rpx 1rpx 0.5rpx 0.5rpx #eee, -1rpx -1rpx 0.5rpx 0.5rpx #eee;
}
.danger-name {
display: flex;
background-color: white;
margin: 3vh 5vw;
justify-content: space-between;
padding: 1vh 2vw;
border-radius: 5px;
box-shadow: 1rpx 1rpx 0.5rpx 0.5rpx #eee, -1rpx -1rpx 0.5rpx 0.5rpx #eee;
}
.child-hdname {
padding: 20rpx;
border-radius: 5rpx;
box-shadow: 1rpx 1rpx 0.5rpx 0.5rpx #eee, -1rpx -1rpx 0.5rpx 0.5rpx #eee;
margin: 10rpx 10rpx;
}
.danger-type {
display: flex;
background-color: white;
margin: 3vh 5vw;
justify-content: space-between;
padding: 1vh 2vw;
border-radius: 5px;
box-shadow: 1rpx 1rpx 0.5rpx 0.5rpx #eee, -1rpx -1rpx 0.5rpx 0.5rpx #eee;
}
.danger-rect {
background-color: white;
margin: 3vh 5vw;
justify-content: space-between;
padding: 1vh 2vw;
border-radius: 5px;
box-shadow: 1rpx 1rpx 0.5rpx 0.5rpx #eee, -1rpx -1rpx 0.5rpx 0.5rpx #eee;
}
.danger-img {
background-color: white;
margin: 3vh 5vw;
justify-content: space-between;
padding: 1vh 2vw;
border-radius: 5px;
box-shadow: 1rpx 1rpx 0.5rpx 0.5rpx #eee, -1rpx -1rpx 0.5rpx 0.5rpx #eee;
}
.danger-img button {
background-color: #1d2089!important;
}
.danger-preview {
background-color: white;
margin: 3vh 5vw;
justify-content: space-between;
padding: 1vh 2vw;
border-radius: 5px;
box-shadow: 1rpx 1rpx 0.5rpx 0.5rpx #eee, -1rpx -1rpx 0.5rpx 0.5rpx #eee;
}
.danger-preview image{
width: 100%;
}
.danger-rect-date {
display: flex;
background-color: white;
margin: 3vh 5vw;
justify-content: space-between;
padding: 1vh 2vw;
border-radius: 5px;
box-shadow: 1rpx 1rpx 0.5rpx 0.5rpx #eee, -1rpx -1rpx 0.5rpx 0.5rpx #eee;
}
.danger-recept-per {
display: flex;
background-color: white;
margin: 3vh 5vw;
justify-content: space-between;
padding: 1vh 2vw;
border-radius: 5px;
box-shadow: 1rpx 1rpx 0.5rpx 0.5rpx #eee, -1rpx -1rpx 0.5rpx 0.5rpx #eee;
}
.rect-img {
background-color: white;
margin: 3vh 5vw;
justify-content: space-between;
padding: 1vh 1vw;
}
.rect-preview {
background-color: white;
margin: 3vh 5vw;
justify-content: space-between;
padding: 1vh 1vw;
}
.danger-status {
display: flex;
background-color: white;
margin: 3vh 5vw;
justify-content: space-between;
padding: 1vh 2vw;
border-radius: 5px;
box-shadow: 1rpx 1rpx 0.5rpx 0.5rpx #eee, -1rpx -1rpx 0.5rpx 0.5rpx #eee;
}
.danger-submit button {
background-color: #1d2089!important;
}
.c11-1 {
display: flex;
background-color: white;
margin: 3vh 5vw;
justify-content: space-between;
padding: 1vh 2vw;
border-radius: 5px;
box-shadow: 1rpx 1rpx 0.5rpx 0.5rpx #eee, -1rpx -1rpx 0.5rpx 0.5rpx #eee;
}
\ No newline at end of file
...@@ -6,7 +6,7 @@ Page({ ...@@ -6,7 +6,7 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
msgShow:false, msgShow: false,
dglist: [], dglist: [],
curEnterName: '', curEnterName: '',
leftMove: {}, leftMove: {},
...@@ -28,9 +28,13 @@ Page({ ...@@ -28,9 +28,13 @@ Page({
this.setData({ this.setData({
curEnterName: app.globalData.currentEnter.companyName curEnterName: app.globalData.currentEnter.companyName
}) })
// console.log('dgonload') console.log('dgonload')
this.getDataList()
console.log(this.data.curRole, 'sssssssssss-----------------------')
},
getDataList() {
wx.showLoading({ wx.showLoading({
title: '正在加载隐患列表', title: '正在加载',
}) })
wx.request({ wx.request({
url: app.globalData.appBaseUrl + '/api/thHiddenDanger', url: app.globalData.appBaseUrl + '/api/thHiddenDanger',
...@@ -39,7 +43,7 @@ Page({ ...@@ -39,7 +43,7 @@ Page({
Authorization: app.globalData.Authorization Authorization: app.globalData.Authorization
}, },
data: { data: {
county:app.globalData.appCounty, county: app.globalData.appCounty,
companyId: app.globalData.currentEnter.companyId, companyId: app.globalData.currentEnter.companyId,
sort: 'hdId,asc', sort: 'hdId,asc',
page: 0, page: 0,
...@@ -49,38 +53,23 @@ Page({ ...@@ -49,38 +53,23 @@ Page({
Authorization: app.globalData.Authorization Authorization: app.globalData.Authorization
}, },
success: (res) => { success: (res) => {
let arr= [...res.data.content] let arr = [...res.data.content]
let newarr = []; if (res.status === 401) {
arr.map((item,index)=>{
newarr.push(Object.assign(item,{msgShow:false}))
})
arr = newarr;
console.log(arr, '获取当前企业的隐患arr3')
if (res.statusCode === 200) {
this.setData({
dglist: [...res.data.content]
})
return;
} else if (res.statusCode === 401) {
wx.redirectTo({ wx.redirectTo({
url: '/pages/login/login', url: '/pages/login/login',
}) })
} else { return
wx.showToast({
title: '获取失败',
icon: 'error',
duration: 2000
})
} }
this.setData({
dglist: arr
})
wx.hideLoading() wx.hideLoading()
}, },
fail: () => { fail: () => {
wx.hideLoading() wx.hideLoading()
} }
}) })
console.log(this.data.curRole,'sssssssssss-----------------------')
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
...@@ -92,7 +81,7 @@ Page({ ...@@ -92,7 +81,7 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
// console.log('dgonshow') console.log('dgonshow')
wx.setNavigationBarTitle({ wx.setNavigationBarTitle({
title: app.globalData.currentEnter.companyName, title: app.globalData.currentEnter.companyName,
}) })
...@@ -100,49 +89,7 @@ Page({ ...@@ -100,49 +89,7 @@ Page({
backgroundColor: '#090D9C', backgroundColor: '#090D9C',
frontColor: '#ffffff' frontColor: '#ffffff'
}) })
wx.showLoading({ this.getDataList()
title: '正在加载隐患列表',
})
wx.request({
url: app.globalData.appBaseUrl + '/api/thHiddenDanger',
method: 'GET',
header: {
Authorization: app.globalData.Authorization
},
data: {
county:app.globalData.appCounty,
companyId: app.globalData.currentEnter.companyId,
sort: 'hdId,asc',
page: 0,
size: 99999
},
header: {
Authorization: app.globalData.Authorization
},
success: (res) => {
let arr= [...res.data.content]
let newarr = [];
arr.map((item,index)=>{
newarr.push(Object.assign(item,{msgShow:false}))
})
arr = newarr;
console.log(arr, '获取当前企业的隐患arr2')
if (res.status === 200) {
this.setData({
dglist: [...res.data.content]
})
} else if (res.status === 401) {
wx.redirectTo({
url: '/pages/login/login',
})
}
wx.hideLoading()
},
fail: () => {
wx.hideLoading()
}
})
}, },
/** /**
...@@ -195,7 +142,9 @@ Page({ ...@@ -195,7 +142,9 @@ Page({
editHD(event) { editHD(event) {
console.log(event.target.dataset.index) console.log(event.target.dataset.index)
// event.target.dateset.index // event.target.dateset.index
app.globalData.currentHD = {...this.data.dglist[event.target.dataset.index]} app.globalData.currentHD = {
...this.data.dglist[event.target.dataset.index]
}
// console.log(app.globalData.currentHD) // console.log(app.globalData.currentHD)
wx.navigateTo({ wx.navigateTo({
url: '/pages/dangeredit/dangeredit', url: '/pages/dangeredit/dangeredit',
...@@ -205,14 +154,23 @@ Page({ ...@@ -205,14 +154,23 @@ Page({
// leftMove: this.animation.export() // leftMove: this.animation.export()
// }) // })
}, },
/**
cancelToDelete() { * 删除隐患
this.animation.bottom('-100%').step() */
this.setData({ deleteHD(event) {
topAnimation: this.animation.export() let that = this
let hdId = this.data.dglist[event.target.dataset.index].hdId
wx.showModal({
title: '提示',
content: '此操作将删除所选项,确认删除?',
success(res) {
if (res.confirm) {
that.confirmToDelete(hdId)
}
}
}) })
}, },
confirmToDelete() { confirmToDelete(hdId) {
wx.showLoading({ wx.showLoading({
title: '正在删除', title: '正在删除',
}) })
...@@ -222,70 +180,19 @@ Page({ ...@@ -222,70 +180,19 @@ Page({
header: { header: {
Authorization: app.globalData.Authorization Authorization: app.globalData.Authorization
}, },
data: [this.data.dglist[this.deleteIndex].hdId], data: [hdId],
header: { header: {
Authorization: app.globalData.Authorization Authorization: app.globalData.Authorization
}, },
success: (res) => { success: (res) => {
// console.log(res, 'hehehheeheh') // console.log(res, 'hehehheeheh')
if (res.statusCode === 200) { if (res.status === 200) {
wx.showToast({ wx.showToast({
title: '删除成功', title: '删除成功',
icon: 'success' icon: 'success'
}) })
this.animation.bottom('-100%').step() this.getDataList()
this.setData({ } else if (res.status === 401) {
topAnimation: this.animation.export()
})
wx.showLoading({
title: '正在加载隐患列表',
})
wx.request({
url: app.globalData.appBaseUrl + '/api/thHiddenDanger',
method: 'GET',
header: {
Authorization: app.globalData.Authorization
},
data: {
county:app.globalData.appCounty,
companyId: app.globalData.currentEnter.companyId,
sort: 'hdId,asc',
page: 0,
size: 99999
},
header: {
Authorization: app.globalData.Authorization
},
success: (res) => {
let arr= [...res.data.content]
let newarr = [];
arr.map((item,index)=>{
newarr.push(Object.assign(item,{msgShow:false}))
})
arr = newarr;
console.log(arr, '获取当前企业的隐患arr')
if (res.statusCode === 200) {
this.setData({
dglist: arr
})
} else if (res.statusCode === 401) {
wx.redirectTo({
url: '/pages/login/login',
})
} else {
wx.showToast({
title: '获取失败',
icon: 'error',
duration: 2000
})
}
wx.hideLoading()
},
fail: () => {
wx.hideLoading()
}
})
} else if (res.statusCode === 401) {
wx.redirectTo({ wx.redirectTo({
url: '/pages/login/login', url: '/pages/login/login',
}) })
...@@ -306,20 +213,7 @@ Page({ ...@@ -306,20 +213,7 @@ Page({
} }
}) })
}, },
/**
* 删除隐患
*/
deleteHD(event) {
console.log(event.target.dataset.index)
this.deleteIndex = event.target.dataset.index
this.animation.bottom(0).step()
this.setData({
topAnimation: this.animation.export()
})
// event.target.dateset.index
},
/** /**
* 新增按钮开启 * 新增按钮开启
*/ */
......
...@@ -14,12 +14,12 @@ ...@@ -14,12 +14,12 @@
<span wx:else>{{item.hdName}}</span> <span wx:else>{{item.hdName}}</span>
</view> </view>
<view > <view >
<span>整改中</span> <span>{{item.hdStatus}}</span>
</view> </view>
<view style="float: right; margin-top: 20px;"> <view style="float: right; margin-top: 20px;">
<button type="default" class="editBtn" size="mini" bindtap="editHD" data-index="{{index}}">查看</button> <button wx-if="{{item.hdStatus===1||item.hdStatus===3}}" type="default" class="editBtn" size="mini" bindtap="editHD" data-index="{{index}}">查看</button>
<button type="default" class="editBtn" size="mini" bindtap="editHD" data-index="{{index}}" >编辑</button> <button wx-if="{{item.hdStatus===0||item.hdStatus===2}}" type="default" class="editBtn" size="mini" bindtap="editHD" data-index="{{index}}" >编辑</button>
<button type="warn" class="delBtn" size="mini" data-index="{{index}}" bindtap="deleteHD">删除</button> <button wx-if="{{item.hdStatus===0}}" type="warn" class="delBtn" size="mini" data-index="{{index}}" bindtap="deleteHD">删除</button>
</view> </view>
</view> </view>
<view wx:if="{{dglist.length === 0}}" class="no-hd">暂无隐患</view> <view wx:if="{{dglist.length === 0}}" class="no-hd">暂无隐患</view>
......
...@@ -6,6 +6,8 @@ Page({ ...@@ -6,6 +6,8 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
inputEnterName: '',
animationSearch: {},
enterImgUrl: 'http://39.102.232.151:8030/cover/企业搜索icon.png', enterImgUrl: 'http://39.102.232.151:8030/cover/企业搜索icon.png',
verifyStatus: [{ verifyStatus: [{
name: '整合中', name: '整合中',
...@@ -25,8 +27,8 @@ Page({ ...@@ -25,8 +27,8 @@ Page({
value: 2 value: 2
}, },
], ],
selectedStatus: '', selectedStatusText: '',
selectedstatus: '', selectedStatusValue: '',
msgShow: false, msgShow: false,
dglist: [], dglist: [],
curEnterName: '', curEnterName: '',
...@@ -161,22 +163,77 @@ Page({ ...@@ -161,22 +163,77 @@ Page({
onShareAppMessage: function () { onShareAppMessage: function () {
// console.log('dgonshareappmessage') // console.log('dgonshareappmessage')
}, },
getDataList() { focusInputName(event) {
wx.request({ let repheight = 0
url: app.globalData.appBaseUrl + '/api/hiddenDangerToVerify', wx.getSystemInfoAsync({
method: 'GET', success: (result) => {
header: { repheight = result.windowHeight
Authorization: app.globalData.Authorization
}, },
data: { })
this.repheight = repheight
console.log(this.repheight, 'this.repheight')
// animationsearch
//animationlist
const repAnimation = wx.createAnimation({
duration: 40,
timingFunction: 'linear'
})
this.animate1 = repAnimation
// repAnimation.translateY(-repheight/2 + 'px').scale(1).step()
repAnimation.top(0).scale(1.0).step()
this.setData({
animationsearch: repAnimation.export()
})
const tempAnimation = wx.createAnimation({
durartion: 400,
timingFunction: 'linear'
})
this.animate2 = tempAnimation
tempAnimation.opacity(1).step()
this.setData({
animationlist: tempAnimation.export()
})
},
/**
* 输入企业信息
*/
// enterNameInput(event) {
// this.data.inputEnterName = event.detail.value
// },
/**
* 触摸面板 搜索企业信息
*/
enterNameConfirm(event) {
this.data.inputEnterName = event.detail.value
this.getDataList()
},
getDataList() {
wx.showLoading({
title: '加载中',
})
let reqParam = {
county: app.globalData.appCounty, county: app.globalData.appCounty,
// companyId: app.globalData.currentEnter.companyId, // companyId: app.globalData.currentEnter.companyId,
// enName: '', enName: this.data.inputEnterName,
// verifyState: this.selectedstatus, verifyState: this.data.selectedstatusValue,
sort: 'verify_status,asc', sort: 'verify_status,asc',
page: 0, page: 0,
size: 99999 size: 99999
}
if(!reqParam.verifyState){
delete reqParam['verifyState']
}
if(!reqParam.enName){
delete reqParam['enName']
}
wx.request({
url: app.globalData.appBaseUrl + '/api/hiddenDangerToVerify',
method: 'GET',
header: {
Authorization: app.globalData.Authorization
}, },
data: reqParam,
header: { header: {
Authorization: app.globalData.Authorization Authorization: app.globalData.Authorization
}, },
...@@ -199,9 +256,10 @@ Page({ ...@@ -199,9 +256,10 @@ Page({
chooseCounty(e) { chooseCounty(e) {
let that = this; let that = this;
this.setData({ this.setData({
selectedStatus: that.data.verifyStatus[e.detail.value].name, selectedStatusText: that.data.verifyStatus[e.detail.value].name,
selectedstatus: that.data.verifyStatus[e.detail.value].value selectedstatusValue: that.data.verifyStatus[e.detail.value].value
}) })
this.getDataList()
}, },
/** /**
* 审核通过 * 审核通过
...@@ -308,7 +366,7 @@ Page({ ...@@ -308,7 +366,7 @@ Page({
placeholderText: '请输入审核拒绝原因', placeholderText: '请输入审核拒绝原因',
success(res) { success(res) {
if (res.confirm) { if (res.confirm) {
if(!res.content){ if (!res.content) {
wx.showToast({ wx.showToast({
title: '原因不能为空', title: '原因不能为空',
icon: 'error', icon: 'error',
......
<!--pages/dangerlist/dangerlist.wxml--> <!--pages/dangerlist/dangerlist.wxml-->
<!-- bindtap="addNewHD" wx:if="{{!(curRole=='政府')}}">新增</button> --> <!-- bindtap="addNewHD" wx:if="{{!(curRole=='政府')}}">新增</button> -->
<view class="search-wrapper"> <view class="search-wrapper">
<input type="text" class="enter-name-input" placeholder="请输入企业名称" value="{{inputEnterName}}" confirm-type="search" bindconfirm="enterNameConfirm" bindinput="enterNameInput" bindfocus="focusInputName" bindblur="blurInputName" animation="{{animationSearch}}" bindfocus="searchInputFocus"> <input type="text" class="enter-name-input" placeholder="请输入企业名称" value="{{inputEnterName}}" confirm-type="search" bindconfirm="enterNameConfirm" bindinput="enterNameInput">
<image class="enter-img" src="{{enterImgUrl}}" alt="error"></image> <image class="enter-img" src="{{enterImgUrl}}" alt="error"></image>
</input> </input>
</view> </view>
<view class="choose-county"> <view class="verfyStatusWrapper">
<picker header-text="选择状态" mode="selector" range="{{verifyStatus}}" range-key="name" bindchange="chooseCounty"> <picker header-text="选择状态" mode="selector" range="{{verifyStatus}}" range-key="name" bindchange="chooseCounty">
审核状态: 审核状态:
<span> {{selectedStatus}}</span> <span> {{selectedStatusText}}</span>
</picker> </picker>
</view> </view>
<view class="dangerlist-wrapper"> <view class="dangerlist-wrapper">
...@@ -21,12 +19,12 @@ ...@@ -21,12 +19,12 @@
<span wx:else>{{item.hdName}}</span> <span wx:else>{{item.hdName}}</span>
</view> </view>
<view> <view>
<span>整改中</span> <span>{{item.verifyStatus}}</span>
</view> </view>
<view style="float: right; margin-top: 20px;"> <view style="float: right; margin-top: 20px;">
<button type="default" class="editBtn" size="mini" bindtap="detail" data-index="{{index}}">查看</button> <button type="default" class="editBtn" size="mini" bindtap="detail" data-index="{{index}}">查看</button>
<button type="default" class="editBtn" size="mini" bindtap="pass" data-index="{{index}}">通过</button> <button type="default" class="editBtn" wx-if="{{item.verifyStatus===3}}" size="mini" bindtap="pass" data-index="{{index}}">通过</button>
<button type="default" class="editBtn" size="mini" bindtap="refuse" data-index="{{index}}">拒绝</button> <button type="default" class="editBtn" wx-if="{{item.verifyStatus===3}}" size="mini" bindtap="refuse" data-index="{{index}}">拒绝</button>
</view> </view>
</view> </view>
<view wx:if="{{dglist.length === 0}}" class="no-hd">暂无数据</view> <view wx:if="{{dglist.length === 0}}" class="no-hd">暂无数据</view>
......
/* pages/dangerlist/dangerlist.wxss */ /* pages/dangerlist/dangerlist.wxss */
.verfyStatusWrapper{
margin-top: 120rpx;
margin-left: 30rpx;
/* position: relative;
top: 120rpx;
left: 20rpx; */
}
.enterprises-wrapper { .enterprises-wrapper {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
...@@ -47,7 +56,7 @@ ...@@ -47,7 +56,7 @@
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
position: relative; position: relative;
padding-top: 120rpx; padding-top: 40rpx;
box-sizing: border-box; box-sizing: border-box;
overflow: hidden; overflow: hidden;
} }
......
...@@ -277,15 +277,6 @@ Page({ ...@@ -277,15 +277,6 @@ Page({
* 拍照 * 拍照
*/ */
takePhoto() { takePhoto() {
// const ctx = wx.createCameraContext()
// ctx.takePhoto({
// quality: 'high',
// success: (res) => {
// this.setData({
// imgsrc: res.tempImagePath
// })
// }
// })
wx.chooseImage({ wx.chooseImage({
success: (res) => { success: (res) => {
this.data.hdFilePath = res.tempFilePaths[0] this.data.hdFilePath = res.tempFilePaths[0]
...@@ -293,8 +284,6 @@ Page({ ...@@ -293,8 +284,6 @@ Page({
filePath: res.tempFilePaths[0], // 选择图片返回的相对路径 filePath: res.tempFilePaths[0], // 选择图片返回的相对路径
encoding: 'base64', //编码格式 encoding: 'base64', //编码格式
success: res1 => { // 成功的回调 success: res1 => { // 成功的回调
// console.log('data:image/png;base64, ' + res1.data)
// this.imgsrc = 'data:image/png;base64,' + res1.data
this.setData({ this.setData({
imgsrcurl: 'data:image/png;base64,' + res1.data imgsrcurl: 'data:image/png;base64,' + res1.data
}) })
...@@ -364,6 +353,47 @@ Page({ ...@@ -364,6 +353,47 @@ Page({
}, },
// 提交隐患 // 提交隐患
submitDanger() { submitDanger() {
if(!this.data.hdInspectDate){
wx.showToast({
title: '检查日期不能为空',
icon: 'error',
duration: 1000
})
return
}
if (!this.data.curSelectSecType) {
wx.showToast({
title: '请选择安全类别',
icon: 'error',
duration: 1000
})
return;
}
if (!this.data.curSelectSecCheckTypeReplace) {
wx.showToast({
title: '请选择安全检查类别',
icon: 'error',
duration: 1000
})
return;
}
if (!this.data.curSelectCheckContent) {
wx.showToast({
title: '请选择安全检查内容',
icon: 'error',
duration: 1000
})
return;
}
if (!this.data.hdName) {
wx.showToast({
title: '请选择发现问题',
icon: 'error',
duration: 1000
})
return;
}
if(!this.data.imgsrcurl){ if(!this.data.imgsrcurl){
wx.showToast({ wx.showToast({
title: '没有隐患照片', title: '没有隐患照片',
...@@ -405,7 +435,9 @@ Page({ ...@@ -405,7 +435,9 @@ Page({
url: app.globalData.appBaseUrl + '/api/thHiddenDanger', url: app.globalData.appBaseUrl + '/api/thHiddenDanger',
formData: formData, formData: formData,
header: { header: {
Authorization: app.globalData.Authorization Authorization: app.globalData.Authorization,
chartset: 'utf-8',
'content-type': 'application/x-www-form-urlencoded'
}, },
success: (res) => { success: (res) => {
console.log(res, '文件上传') console.log(res, '文件上传')
...@@ -447,7 +479,7 @@ Page({ ...@@ -447,7 +479,7 @@ Page({
} else { } else {
delete formData.hdInspectDate delete formData.hdInspectDate
} }
if(that.data.comment==''||that.data.comment==null||!that.data.comment){ if(!that.data.comment){
delete formData.comment delete formData.comment
} }
if (formData.hdRectificationDate) { if (formData.hdRectificationDate) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment