Commit 976ba0b6 authored by xinzhedeai's avatar xinzhedeai

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

parent 6727dc0f
......@@ -51,7 +51,28 @@ Page({
topAnimation: {},
curRole:'',
isToEnLarge: false,
xcx:'xcx'
xcx:'xcx',
// 总的安全类别
secType: [
{
name: '安全资料类'
},
{
name: '现场检查类'
}
],
//
curSelectSecType: '',
// 安全检查类别
secCheckType: [],
// 安全检查类别替代
secCheckTypeReplace: [],
// 当前选择的安全检查类别
curSelectSecCheckTypeReplace: '',
// 安全检查内容
secCheckContent: [],
// 当前选择的安全检查内容
curSelectCheckContent: '',
},
/**
......@@ -62,6 +83,9 @@ Page({
this.setData({
curRole: app.globalData.curRole
})
const animation = wx.createAnimation({
delay: 10,
timingFunction: 'linear'
......@@ -71,6 +95,15 @@ Page({
this.setData(
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')
// 调用接口 获取图片
wx.request({
......@@ -90,7 +123,7 @@ Page({
Authorization: app.globalData.Authorization
},
success: (res) => {
if (res.statusCode === 401) {
if (res.status === 401) {
wx.redirectTo({
url: '/pages/login/login',
})
......@@ -178,11 +211,189 @@ Page({
onShareAppMessage: function () {
},
// 输入整改评价
inputEvaluation(event) {
// 选择检查日期
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) {
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
},
/**
* 拍摄整改照片
*/
/**
* 拍摄隐患图片
*/
takePhoto() {
......@@ -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
// })
// }
// })
// }
// })
// },
/**
* 输入整改日期
*/
......@@ -284,7 +465,7 @@ Page({
},
/**
/**
* 提交修改
*/
submitEdit() {
......@@ -331,9 +512,9 @@ Page({
success: (res) => {
console.log(res, '文件编辑上传')
wx.hideLoading()
if (res.status === 201) {
if (res.status === 200) {
wx.showToast({
title: '编辑成功',
title: '操作成功',
icon: 'success'
})
wx.navigateBack()
......@@ -405,8 +586,7 @@ Page({
},
data: this.formatFormData(formData),
success: (res) => {
console.log(res, '上传成功了吗afhdhsfhhdsfhadsf')
if(res.statusCode===204){
if(res.status===200){
wx.showToast({
title: '编辑成功',
icon: 'success',
......@@ -416,7 +596,7 @@ Page({
wx.navigateBack()
}, 2000);
}else if(res.statusCode===400){
}else if(res.status===400){
wx.showToast({
title: res.data.message,
icon: 'error',
......
<!--pages/dangeredit/dangeredit.wxml-->
<view class="danger-edit-wrapper">
<scroll-view
scroll-y="true"
class="danger-form-wrapper">
<!-- <view class="danger-order">
<scroll-view scroll-y="true" class="danger-form-wrapper">
<!-- <view class="danger-order">
<text>序号:</text>
<input type="text" disabled="{{!editAble}}" />
</view> -->
<view class="danger-check-date">
<text>检查日期:</text>
<picker class="danger-pick-date" disabled="{{!editAble}}" mode="date" value="{{hdInspectDate}}" bindchange="">
<view class="current-picker">
当前选择: {{hdInspectDate}}
<view class="danger-check-date">
<text>检查日期:</text>
<picker class="danger-pick-date" disabled="{{!editAble}}" mode="date" value="{{hdInspectDate}}" bindchange="selectCheckDate">
<view class="current-picker">
当前选择: {{hdInspectDate}}
</view>
</picker>
</view>
</picker>
</view>
<view class="danger-expert">
<text>检查人员:</text>
<input type="text" disabled="{{!editAble}}" placeholder="请输入人员名称" value="{{hdInspectExpert}}" bindinput="" />
</view>
<view class="danger-type">
<text>隐患类型:</text>
<radio-group bindchange="">
<radio color="#1d2089" disabled="{{!editAble}}" checked="{{hdLevel===1}}" value="1" >一般隐患</radio>
<radio color="#1d2089" disabled="{{!editAble}}" checked="{{hdLevel===2}}" value="2" >重大隐患</radio>
</radio-group>
</view>
<block wx:if="{{comment==''||comment==null}}">
<view class="danger-name">
<text style="width:200rpx ;">隐患名称:</text>
<textarea type="text" disabled="{{!editAble}}" placeholder="请输入隐患名称" value="{{hdName}}" bindinput="" maxlength="-1" />
</view>
</block>
<view class="danger-expert">
<text style="width:200rpx ;">隐患描述: </text>
<textarea type="text" disabled="{{!editAble}}" placeholder="请输入隐患描述" value="{{comment}}" bindinput="" maxlength="-1" />
</view>
<view class="danger-expert">
<text style="width:200rpx ;">检查依据: </text>
<textarea type="text" disabled="{{!editAble}}" placeholder="请输入检查依据" value="{{basis}}" bindinput="" maxlength="-1" />
<view class="danger-expert">
<text>检查人员:</text>
<input type="text" disabled="{{!editAble}}" placeholder="请输入人员名称" value="{{hdInspectExpert}}" bindinput="inputHdInspectExpert" />
</view>
<view class="danger-type">
<text>隐患等级:</text>
<radio-group bindchange="inputHDType">
<radio color="#1d2089" disabled="{{!editAble}}" checked="{{hdLevel===1}}" value="1">一般隐患</radio>
<radio color="#1d2089" disabled="{{!editAble}}" checked="{{hdLevel===2}}" value="2">重大隐患</radio>
</radio-group>
</view>
<view class="c11-1">
<text>安全类别:</text>
<view>
<picker
header-text="安全类别"
mode="selector"
range="{{secType}}"
range-key="name"
bindchange="chooseSecType"
>
当前选择: {{curSelectSecType}}
</picker>
</view>
</view>
<view class="danger-rect">
<text>整改建议:</text>
<textarea wx:if="{{suggestion!=''}}" disabled="{{!editAble}}" maxlength="-1" bindinput="" value="{{suggestion}}"></textarea>
<textarea wx:else="{{suggestion==''}}" disabled="{{!editAble}}" maxlength="-1" bindinput="" value="{{hdRectificationSug}}"></textarea>
<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="hdPic-preview">
<text>隐患照片预览:</text>
<image mode="aspectFit" src="{{imgsrcurl}}"
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>
<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="danger-img">
<text>整改照片</text>
<!-- <camera device-position="back" flash="off" style="width:100%;height:300px;"></camera> -->
<image mode="aspectFit" src="{{imgrecturl}}" bindtap="toEnlargePicByRectPic"></image>
<view class="c11-1">
<text>发现问题</text>
<view>
<picker
header-text="发现问题"
mode="selector"
range="{{secCheckDiscover}}"
range-key="name"
bindchange="chooseSecCheckDiscover"
>当前选择:{{hdName}}</picker>
</view>
</view>
<view class="danger-rect-date" >
<text>整改期限:</text>
<picker wx:if="{{(curRole=='政府')}}" class="danger-pick-date" mode="date" bindchange="inputRectification" value="{{recDeadLine}}">
<view class="current-picker">
当前选择: {{recDeadLine ? recDeadLine : ''}}
<view class="danger-expert">
<text style="width:200rpx ;">隐患描述: </text>
<input type="text" disabled="{{!editAble}}" value="{{comment}}" bindinput="inputHdComment" maxlength="-1" />
</view>
</picker>
<picker wx:if="{{(curRole!=='政府')}}" class="danger-pick-date" mode="date" bindchange="inputRectification" value="{{recDeadLine}}">
<view class="current-picker">
当前选择: {{recDeadLine ? recDeadLine : ''}}
<view class="danger-expert">
<text style="width:200rpx ;">检查依据: </text>
<textarea type="text" value="{{basis}}" bindinput="" maxlength="-1" />
</view>
</picker>
</view>
<view class="danger-rect-date" wx:if="{{!showButton}}">
<text>复查日期:</text>
<picker class="danger-pick-date" disabled="true" mode="date" bindchange="inputRectDate" value="{{hdRectificationDate}}">
<view class="current-picker">
当前选择: {{hdRectificationDate ? hdRectificationDate : ''}}
<view class="danger-rect">
<text>整改建议:</text>
<textarea wx:if="{{suggestion!=''}}" disabled="{{!editAble}}" maxlength="-1" bindinput="" value="{{suggestion}}"></textarea>
<textarea wx:else="{{suggestion==''}}" disabled="{{!editAble}}" maxlength="-1" bindinput="" value="{{hdRectificationSug}}"></textarea>
</view>
</picker>
</view>
<view class="danger-recept-per">
<text>复查人员:</text>
<input type="text" placeholder="请输入验收人" value="{{hdAcceptancePerson}}" disabled="true" bindinput="inputAcceptancePer" />
</view>
<view class="danger-rect" >
<text>复查记录:</text>
<textarea disabled="true" maxlength="-1" bindinput="" value="{{recEvaluation}}"></textarea>
</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}}">
<button type="primary" bindtap="submitEdit" style="background-color: #1d2089;" >提交修改</button>
</view>
</scroll-view>
<view class="enlarge-pic-wrapper {{isToEnLarge? 'enlarge-pic-show': ''}}">
<image
src="{{enlargeUrl}}"
mode="aspectFit"
class="enlarge-pic"
bindtap="toCancelEnlargePic"
></image>
</view>
</view>
<view class="hdPic-preview">
<text>隐患照片:</text>
<image mode="aspectFit" src="{{imgsrcurl}}" bindtap="toEnlargePicByHiddenPic"></image>
<button wx:if="{{editAble}}" type="primary" bindtap="takePhoto" style="background-color: #1d2089;">拍照</button>
</view>
<view class="danger-img">
<text>整改照片</text>
<!-- <camera device-position="back" flash="off" style="width:100%;height:300px;"></camera> -->
<image mode="aspectFit" src="{{imgrecturl}}" bindtap="toEnlargePicByRectPic"></image>
</view>
<view class="danger-rect-date">
<text>整改期限:</text>
<picker class="danger-pick-date" mode="date" bindchange="inputRectification" value="{{recDeadLine}}">
<view class="current-picker">
当前选择: {{recDeadLine ? recDeadLine : ''}}
</view>
</picker>
</view>
<view class="danger-rect-date">
<text>复查日期:</text>
<picker class="danger-pick-date" disabled="true" mode="date" bindchange="inputRectDate" value="{{hdRectificationDate}}">
<view class="current-picker">
当前选择: {{hdRectificationDate ? hdRectificationDate : ''}}
</view>
</picker>
</view>
<view class="danger-recept-per">
<text>复查人员:</text>
<input type="text" value="{{hdAcceptancePerson}}" disabled="true" bindinput="inputAcceptancePer" />
</view>
<view class="danger-rect">
<text>复查记录:</text>
<textarea disabled="true" maxlength="-1" bindinput="" value="{{recEvaluation}}"></textarea>
</view>
<view class="danger-submit" wx:if="{{editAble}}">
<button type="primary" bindtap="submitEdit" style="background-color: #1d2089;">提交修改</button>
</view>
</scroll-view>
<view class="enlarge-pic-wrapper {{isToEnLarge? 'enlarge-pic-show': ''}}">
<image src="{{enlargeUrl}}" mode="aspectFit" class="enlarge-pic" bindtap="toCancelEnlargePic"></image>
</view>
</view>
\ No newline at end of file
......@@ -177,4 +177,172 @@
.enlarge-pic {
width: 100vw;
height: 100vh;
}
\ No newline at end of file
}
/* 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
......@@ -2,349 +2,243 @@ const app = getApp()
// pages/dangerlist/dangerlist.js
Page({
/**
* 页面的初始数据
*/
data: {
msgShow:false,
dglist: [],
curEnterName: '',
leftMove: {},
topAnimation: {},
curRole: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
curRole: app.globalData.curRole
})
const animation = wx.createAnimation({
delay: 20,
timingFunction: 'linear'
})
this.animation = animation
this.setData({
curEnterName: app.globalData.currentEnter.companyName
})
// console.log('dgonload')
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}))
/**
* 页面的初始数据
*/
data: {
msgShow: false,
dglist: [],
curEnterName: '',
leftMove: {},
topAnimation: {},
curRole: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
curRole: app.globalData.curRole
})
arr = newarr;
console.log(arr, '获取当前企业的隐患arr3')
if (res.statusCode === 200) {
this.setData({
dglist: [...res.data.content]
})
return;
} else if (res.statusCode === 401) {
wx.redirectTo({
url: '/pages/login/login',
})
} else {
wx.showToast({
title: '获取失败',
icon: 'error',
duration: 2000
})
}
wx.hideLoading()
},
fail: () => {
wx.hideLoading()
}
})
console.log(this.data.curRole,'sssssssssss-----------------------')
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
// console.log('dgonready')
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
// console.log('dgonshow')
wx.setNavigationBarTitle({
title: app.globalData.currentEnter.companyName,
})
wx.setNavigationBarColor({
backgroundColor: '#090D9C',
frontColor: '#ffffff'
})
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}))
const animation = wx.createAnimation({
delay: 20,
timingFunction: 'linear'
})
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()
}
})
},
this.animation = animation
this.setData({
curEnterName: app.globalData.currentEnter.companyName
})
console.log('dgonload')
this.getDataList()
console.log(this.data.curRole, 'sssssssssss-----------------------')
},
getDataList() {
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]
if (res.status === 401) {
wx.redirectTo({
url: '/pages/login/login',
})
return
}
this.setData({
dglist: arr
})
wx.hideLoading()
},
fail: () => {
wx.hideLoading()
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
// console.log('dgonready')
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
// console.log('dgonhide')
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
console.log('dgonshow')
wx.setNavigationBarTitle({
title: app.globalData.currentEnter.companyName,
})
wx.setNavigationBarColor({
backgroundColor: '#090D9C',
frontColor: '#ffffff'
})
this.getDataList()
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
// console.log('dgonupload')
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
// console.log('dgonhide')
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
// console.log('dgonpulldown')
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
// console.log('dgonupload')
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
// console.log('dgonreachBottom')
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
// console.log('dgonpulldown')
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
// console.log('dgonshareappmessage')
},
/**
* 新增隐患
*/
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
// console.log('dgonreachBottom')
},
addNewHD(event) {
console.log(event, 'hehe')
wx.navigateTo({
url: '/pages/dangerregister/dangerregister',
})
},
/**
* 编辑隐患
*/
editHD(event) {
console.log(event.target.dataset.index)
// event.target.dateset.index
app.globalData.currentHD = {...this.data.dglist[event.target.dataset.index]}
// console.log(app.globalData.currentHD)
wx.navigateTo({
url: '/pages/dangeredit/dangeredit',
})
// this.animation.translateX('50rpx').step()
// this.setData({
// leftMove: this.animation.export()
// })
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
// console.log('dgonshareappmessage')
},
/**
* 新增隐患
*/
cancelToDelete() {
this.animation.bottom('-100%').step()
this.setData({
topAnimation: this.animation.export()
})
},
confirmToDelete() {
wx.showLoading({
title: '正在删除',
})
wx.request({
url: app.globalData.appBaseUrl + '/api/thHiddenDanger',
method: 'DELETE',
header: {
Authorization: app.globalData.Authorization
},
data: [this.data.dglist[this.deleteIndex].hdId],
header: {
Authorization: app.globalData.Authorization
},
success: (res) => {
// console.log(res, 'hehehheeheh')
if (res.statusCode === 200) {
wx.showToast({
title: '删除成功',
icon: 'success'
})
this.animation.bottom('-100%').step()
this.setData({
topAnimation: this.animation.export()
})
wx.showLoading({
title: '正在加载隐患列表',
})
wx.request({
addNewHD(event) {
console.log(event, 'hehe')
wx.navigateTo({
url: '/pages/dangerregister/dangerregister',
})
},
/**
* 编辑隐患
*/
editHD(event) {
console.log(event.target.dataset.index)
// event.target.dateset.index
app.globalData.currentHD = {
...this.data.dglist[event.target.dataset.index]
}
// console.log(app.globalData.currentHD)
wx.navigateTo({
url: '/pages/dangeredit/dangeredit',
})
// this.animation.translateX('50rpx').step()
// this.setData({
// leftMove: this.animation.export()
// })
},
/**
* 删除隐患
*/
deleteHD(event) {
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(hdId) {
wx.showLoading({
title: '正在删除',
})
wx.request({
url: app.globalData.appBaseUrl + '/api/thHiddenDanger',
method: 'GET',
method: 'DELETE',
header: {
Authorization: app.globalData.Authorization
},
data: {
county:app.globalData.appCounty,
companyId: app.globalData.currentEnter.companyId,
sort: 'hdId,asc',
page: 0,
size: 99999
Authorization: app.globalData.Authorization
},
data: [hdId],
header: {
Authorization: app.globalData.Authorization
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 {
// console.log(res, 'hehehheeheh')
if (res.status === 200) {
wx.showToast({
title: '删除成功',
icon: 'success'
})
this.getDataList()
} else if (res.status === 401) {
wx.redirectTo({
url: '/pages/login/login',
})
} else {
wx.showToast({
title: '删除失败',
icon: 'success'
})
}
},
fail: () => {
wx.showToast({
title: '获取失败',
icon: 'error',
duration: 2000
title: '删除失败',
})
}
wx.hideLoading()
},
fail: () => {
wx.hideLoading()
complete: () => {
wx.hideLoading()
}
})
} else if (res.statusCode === 401) {
wx.redirectTo({
url: '/pages/login/login',
})
} else {
wx.showToast({
title: '删除失败',
icon: 'success'
})
}
},
fail: () => {
wx.showToast({
title: '删除失败',
})
},
complete: () => {
wx.hideLoading()
}
})
},
/**
* 删除隐患
*/
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
},
/**
* 新增按钮开启
*/
addBtnTouchStart(event) {
const animation = wx.createAnimation({
delay: 0,
duration: 400,
timingFunction: 'ease'
})
this.animation = animation
animation.translateX('-20rpx').step()
this.setData({
leftMove: animation.export()
})
// setTimeout(() => {
// animation.translateX('50rpx').step()
// this.setData({
// leftMove: animation
// })
// }, 400)
},
addBtnTouchEnd() {
this.animation.translateX('0rpx').step()
this.setData({
leftMove: this.animation.export()
})
}
/**
* 新增按钮开启
*/
addBtnTouchStart(event) {
const animation = wx.createAnimation({
delay: 0,
duration: 400,
timingFunction: 'ease'
})
this.animation = animation
animation.translateX('-20rpx').step()
this.setData({
leftMove: animation.export()
})
// setTimeout(() => {
// animation.translateX('50rpx').step()
// this.setData({
// leftMove: animation
// })
// }, 400)
},
addBtnTouchEnd() {
this.animation.translateX('0rpx').step()
this.setData({
leftMove: this.animation.export()
})
}
})
\ No newline at end of file
......@@ -14,12 +14,12 @@
<span wx:else>{{item.hdName}}</span>
</view>
<view >
<span>整改中</span>
<span>{{item.hdStatus}}</span>
</view>
<view style="float: right; margin-top: 20px;">
<button 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 type="warn" class="delBtn" size="mini" data-index="{{index}}" bindtap="deleteHD">删除</button>
<button wx-if="{{item.hdStatus===1||item.hdStatus===3}}" 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 wx-if="{{item.hdStatus===0}}" type="warn" class="delBtn" size="mini" data-index="{{index}}" bindtap="deleteHD">删除</button>
</view>
</view>
<view wx:if="{{dglist.length === 0}}" class="no-hd">暂无隐患</view>
......
......@@ -6,6 +6,8 @@ Page({
* 页面的初始数据
*/
data: {
inputEnterName: '',
animationSearch: {},
enterImgUrl: 'http://39.102.232.151:8030/cover/企业搜索icon.png',
verifyStatus: [{
name: '整合中',
......@@ -25,8 +27,8 @@ Page({
value: 2
},
],
selectedStatus: '',
selectedstatus: '',
selectedStatusText: '',
selectedStatusValue: '',
msgShow: false,
dglist: [],
curEnterName: '',
......@@ -161,22 +163,77 @@ Page({
onShareAppMessage: function () {
// console.log('dgonshareappmessage')
},
focusInputName(event) {
let repheight = 0
wx.getSystemInfoAsync({
success: (result) => {
repheight = result.windowHeight
},
})
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,
// companyId: app.globalData.currentEnter.companyId,
enName: this.data.inputEnterName,
verifyState: this.data.selectedstatusValue,
sort: 'verify_status,asc',
page: 0,
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: {
county: app.globalData.appCounty,
// companyId: app.globalData.currentEnter.companyId,
// enName: '',
// verifyState: this.selectedstatus,
sort: 'verify_status,asc',
page: 0,
size: 99999
},
data: reqParam,
header: {
Authorization: app.globalData.Authorization
},
......@@ -199,9 +256,10 @@ Page({
chooseCounty(e) {
let that = this;
this.setData({
selectedStatus: that.data.verifyStatus[e.detail.value].name,
selectedstatus: that.data.verifyStatus[e.detail.value].value
selectedStatusText: that.data.verifyStatus[e.detail.value].name,
selectedstatusValue: that.data.verifyStatus[e.detail.value].value
})
this.getDataList()
},
/**
* 审核通过
......@@ -308,12 +366,12 @@ Page({
placeholderText: '请输入审核拒绝原因',
success(res) {
if (res.confirm) {
if(!res.content){
if (!res.content) {
wx.showToast({
title: '原因不能为空',
icon: 'error',
duration: 2000
})
})
return
}
that.confirmRefuse(id, res.content)
......
<!--pages/dangerlist/dangerlist.wxml-->
<!-- bindtap="addNewHD" wx:if="{{!(curRole=='政府')}}">新增</button> -->
<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>
</input>
</view>
<view class="choose-county">
<view class="verfyStatusWrapper">
<picker header-text="选择状态" mode="selector" range="{{verifyStatus}}" range-key="name" bindchange="chooseCounty">
审核状态:
<span> {{selectedStatus}}</span>
<span> {{selectedStatusText}}</span>
</picker>
</view>
<view class="dangerlist-wrapper">
......@@ -21,12 +19,12 @@
<span wx:else>{{item.hdName}}</span>
</view>
<view>
<span>整改中</span>
<span>{{item.verifyStatus}}</span>
</view>
<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="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="pass" 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 wx:if="{{dglist.length === 0}}" class="no-hd">暂无数据</view>
......
/* pages/dangerlist/dangerlist.wxss */
.verfyStatusWrapper{
margin-top: 120rpx;
margin-left: 30rpx;
/* position: relative;
top: 120rpx;
left: 20rpx; */
}
.enterprises-wrapper {
width: 100vw;
height: 100vh;
......@@ -47,7 +56,7 @@
width: 100vw;
height: 100vh;
position: relative;
padding-top: 120rpx;
padding-top: 40rpx;
box-sizing: border-box;
overflow: hidden;
}
......
......@@ -277,15 +277,6 @@ Page({
* 拍照
*/
takePhoto() {
// const ctx = wx.createCameraContext()
// ctx.takePhoto({
// quality: 'high',
// success: (res) => {
// this.setData({
// imgsrc: res.tempImagePath
// })
// }
// })
wx.chooseImage({
success: (res) => {
this.data.hdFilePath = res.tempFilePaths[0]
......@@ -293,8 +284,6 @@ Page({
filePath: res.tempFilePaths[0], // 选择图片返回的相对路径
encoding: 'base64', //编码格式
success: res1 => { // 成功的回调
// console.log('data:image/png;base64, ' + res1.data)
// this.imgsrc = 'data:image/png;base64,' + res1.data
this.setData({
imgsrcurl: 'data:image/png;base64,' + res1.data
})
......@@ -364,14 +353,55 @@ Page({
},
// 提交隐患
submitDanger() {
if(!this.data.imgsrcurl){
wx.showToast({
title: '没有隐患照片',
icon: 'error',
duration: 1000
})
return
}
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){
wx.showToast({
title: '没有隐患照片',
icon: 'error',
duration: 1000
})
return
}
console.log(this.data.curRole)
if (this.data.hdFilePath) {
let county = app.globalData.appCounty
......@@ -405,7 +435,9 @@ Page({
url: app.globalData.appBaseUrl + '/api/thHiddenDanger',
formData: formData,
header: {
Authorization: app.globalData.Authorization
Authorization: app.globalData.Authorization,
chartset: 'utf-8',
'content-type': 'application/x-www-form-urlencoded'
},
success: (res) => {
console.log(res, '文件上传')
......@@ -447,7 +479,7 @@ Page({
} else {
delete formData.hdInspectDate
}
if(that.data.comment==''||that.data.comment==null||!that.data.comment){
if(!that.data.comment){
delete formData.comment
}
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