Browse Source

维修信息上传、维修信息验收

master
巴林闲侠 2 years ago
parent
commit
69e1d64ff8
  1. 2
      weapp/package/troubleshooting/index.js
  2. 10
      weapp/package/troubleshooting/index.wxml
  3. 89
      weapp/package/troubleshooting/shootingForm/index.js
  4. 74
      weapp/package/troubleshooting/shootingForm/index.wxml
  5. 6
      weapp/package/troubleshooting/shootingForm/index.wxss

2
weapp/package/troubleshooting/index.js

@ -104,7 +104,7 @@ Page({
console.log(e); console.log(e);
const { shootingid } = e.currentTarget.dataset const { shootingid } = e.currentTarget.dataset
wx.navigateTo({ wx.navigateTo({
url: '/package/troubleshooting/shootingForm/index?shootingid=' + shootingid, url: '/package/troubleshooting/shootingForm/index?shootingid=' + shootingid + '&tabIndex=' + this.data.currentTab,
}) })
}, },

10
weapp/package/troubleshooting/index.wxml

@ -49,12 +49,20 @@
<span>{{item.PatrolRecord.points.project.name}}</span> <span>{{item.PatrolRecord.points.project.name}}</span>
<van-button type="info" round bind:tap="toShootingForm" data-shootingid="{{item.id}}"> <van-button type="info" round bind:tap="toShootingForm" data-shootingid="{{item.id}}">
{{ {{
currentTab == 0?
item.state == 1 ?'制定计划': item.state == 1 ?'制定计划':
item.state == 2 ?'审批计划': item.state == 2 ?'审批计划':
item.state == 3 ?'修改计划': item.state == 3 ?'修改计划':
item.state == 4 ?'维修处理': item.state == 4 ?'维修处理':
item.state == 5 ?'质检验收': item.state == 5 ?'质检验收':
item.state == 6 ?'驳回重修':'查看详情' item.state == 6 ?'查看详情':'驳回重修'
:
item.state == 1 ?'制定计划':
item.state == 2 ?'计划已提交待审批':
item.state == 3 ?'计划审批驳回':
item.state == 4 ?'计划审批通过待维修':
item.state == 5 ?'维修完成待验收':
item.state == 6 ?'验收通过':'驳回重修'
}} }}
</van-button> </van-button>
</view> </view>

89
weapp/package/troubleshooting/shootingForm/index.js

@ -14,6 +14,7 @@ Page({
data: {}, data: {},
strucFocusUser: {}, strucFocusUser: {},
focusPerson: [], focusPerson: [],
tabIndex: '',
shootingid: '', shootingid: '',
pointItemCollapseActiveNames: undefined, pointItemCollapseActiveNames: undefined,
maintenancePersonIndex: undefined, maintenancePersonIndex: undefined,
@ -32,20 +33,25 @@ Page({
planApprovalTime: '', planApprovalTime: '',
repair: '', repair: '',
repairImgs: [], repairImgs: [],
checkDesc: '',
checkImgs: [],
// 表单控制 // 表单控制
isPlanState: false, isPlanState: false,
isApprove: false, isApprove: false,
isRepair: false,
isCheck: false,
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad (options) { onLoad (options) {
const { shootingid } = options const { shootingid, tabIndex } = options
if (shootingid) { if (shootingid) {
this.setData({ this.setData({
shootingid shootingid,
tabIndex
}) })
Promise.all( Promise.all(
[ [
@ -78,8 +84,10 @@ Page({
console.log(nextData); console.log(nextData);
this.setData({ this.setData({
data: nextData, data: nextData,
isPlanState: issue.state == 1 || issue.state == 3, isPlanState: tabIndex == 0 && (issue.state == 1 || issue.state == 3),
isApprove: issue.state == 2 isApprove: tabIndex == 0 && issue.state == 2,
isRepair: tabIndex == 0 && (issue.state == 4 || issue.state == 7),
isCheck: tabIndex == 0 && issue.state == 5,
}) })
this.setData({ this.setData({
strucFocusUser: { strucFocusUser: {
@ -110,6 +118,18 @@ Page({
planApprovalTime: issue.approveDate ? moment(issue.approveDate).format('YYYY-MM-DD HH:mm:ss') : '', planApprovalTime: issue.approveDate ? moment(issue.approveDate).format('YYYY-MM-DD HH:mm:ss') : '',
}) })
} }
if (issue.state > 3) {
this.setData({
repair: issue.repairDesc,
repairImgs: issue.repairImage || [],
})
}
if (issue.state > 4) {
this.setData({
checkDesc: issue.checkOpinion,
checkImgs: issue.checkImage || [],
})
}
}) })
} else { } else {
@ -193,8 +213,8 @@ Page({
// 预览图片 // 预览图片
previewImg: function (e) { previewImg: function (e) {
console.log(e); console.log(e);
const { index, itemindex } = e.currentTarget.dataset const { index, itemindex, type } = e.currentTarget.dataset
const imgs = this.data.data.PatrolRecord.points.inspectContent[itemindex].imgs; const imgs = type == 'point' ? this.data.data.PatrolRecord.points.inspectContent[itemindex].imgs : this.data[type];
const newImgs = imgs.map(i => this.data.imgServer + i); const newImgs = imgs.map(i => this.data.imgServer + i);
wx.previewImage({ wx.previewImage({
current: newImgs[index], current: newImgs[index],
@ -205,8 +225,9 @@ Page({
// 上传图片 // 上传图片
chooseImg: function (e) { // 这里是选取图片的方法 chooseImg: function (e) { // 这里是选取图片的方法
const that = this; const that = this;
const { type } = e.currentTarget.dataset
let pics = []; let pics = [];
const detailPics = that.data.repairImgs const detailPics = that.data[type]
if (detailPics.length >= 20) { if (detailPics.length >= 20) {
wx.showToast({ wx.showToast({
title: '最多选择20张图片上传', title: '最多选择20张图片上传',
@ -237,7 +258,7 @@ Page({
that.uploadimg({ that.uploadimg({
url: getApp().globalData.webUrl + '_upload/attachments/project', // 图片上传的接口 url: getApp().globalData.webUrl + '_upload/attachments/project', // 图片上传的接口
path: pics, // 选取的图片的地址数组 path: pics, // 选取的图片的地址数组
}, 'repairImgs'); }, type);
}, },
}) })
}, },
@ -295,14 +316,13 @@ Page({
// 删除图片 // 删除图片
deleteImg: function (e) { deleteImg: function (e) {
// let imgs = this.data.inspectContent[e.currentTarget.dataset.item].imgs; console.log(e);
// const index = e.currentTarget.dataset.index; const { type, index } = e.currentTarget.dataset
// imgs.splice(index, 1); const imgs = this.data[type]
// const inspectContent = this.data.inspectContent; imgs.splice(index, 1);
// inspectContent[e.currentTarget.dataset.item].imgs = imgs; this.setData({
// this.setData({ [type]: imgs
// inspectContent });
// });
}, },
confirm (e) { confirm (e) {
@ -313,9 +333,12 @@ Page({
shootingid, focusPerson, shootingid, focusPerson,
maintenancePersonIndex, maintenancePersonDepartmentShow, qualityPersonIndex, planStartTime, planEndTime, maintenanceRequirement, maintenancePersonIndex, maintenancePersonDepartmentShow, qualityPersonIndex, planStartTime, planEndTime, maintenanceRequirement,
userInfo, planApproval, userInfo, planApproval,
repair, repairImgs,
checkDesc, checkImgs
} = this.data } = this.data
let nextState = '' let nextState = ''
let confirmData = {} let confirmData = {}
let successMsg = ''
if (state == 1 || state == 3) { if (state == 1 || state == 3) {
nextState = 2 nextState = 2
confirmData = { confirmData = {
@ -327,6 +350,7 @@ Page({
endTime: moment(planEndTime).format(), endTime: moment(planEndTime).format(),
repairAsk: maintenanceRequirement, repairAsk: maintenanceRequirement,
} }
successMsg = '制定完成'
} else if (state == 2) { } else if (state == 2) {
confirmData = { confirmData = {
...confirmData, ...confirmData,
@ -339,14 +363,41 @@ Page({
} else { } else {
nextState = 3 nextState = 3
} }
successMsg = '审核完成'
} else if (state == 4 || state == 7) {
confirmData = {
...confirmData,
repairDesc: repair,
repairImage: repairImgs,
}
nextState = 5
successMsg = '上报成功'
} else if (state == 5) {
confirmData = {
...confirmData,
checkOpinion: checkDesc,
checkImage: checkImgs
}
if (approve == 'agree') {
nextState = 6
} else {
nextState = 7
}
successMsg = '验收完成'
} }
Request.put(editPatrolRecordIssueHandle(shootingid), { Request.put(editPatrolRecordIssueHandle(shootingid), {
...confirmData, ...confirmData,
state: nextState, state: nextState,
}).then(res => { }).then(res => {
// wx.redirectTo({ wx.redirectTo({
// url: '/package/troubleshooting/index' url: '/package/troubleshooting/index',
// }) complete: () => {
wx.showToast({
title: successMsg,
icon: 'success'
})
}
})
}) })
}, },

74
weapp/package/troubleshooting/shootingForm/index.wxml

@ -26,7 +26,7 @@
<view class="fs-cell-title" style="">现场照片</view> <view class="fs-cell-title" style="">现场照片</view>
<view class="fs-cell-content" style=""> <view class="fs-cell-content" style="">
<block wx:for="{{item.imgs}}" wx:for-index="imgIndex" wx:for-item="imgUrl" wx:key="imgIndex"> <block wx:for="{{item.imgs}}" wx:for-index="imgIndex" wx:for-item="imgUrl" wx:key="imgIndex">
<image style="height:160rpx;width:160rpx;padding-right:12rpx;" src="{{imgServer+imgUrl}}" data-img="{{imgServer+imgUrl}}" data-index="{{imgIndex}}" data-key="{{imgIndex}}" data-itemindex="{{index}}" mode="aspectFill" bindtap="previewImg"></image> <image style="height:160rpx;width:160rpx;padding-right:12rpx;" src="{{imgServer+imgUrl}}" data-img="{{imgServer+imgUrl}}" data-index="{{imgIndex}}" data-key="{{imgIndex}}" data-itemindex="{{index}}" mode="aspectFill" bindtap="previewImg" data-type="point"></image>
</block> </block>
</view> </view>
</view> </view>
@ -98,7 +98,7 @@
</view> </view>
</van-cell> </van-cell>
<van-field value="{{ maintenanceRequirement }}" label="维修要求" type="textarea" placeholder="请输入" autosize readonly="{{!isPlanState}}" extra-event-params="{{true}}" border="{{ isPlanState }}" bind:input="onInputChange" data-type='maintenanceRequirement' /> <van-field value="{{ maintenanceRequirement }}" label="维修要求" type="textarea" placeholder="请输入" autosize readonly="{{!isPlanState}}" extra-event-params="{{true}}" border="{{ isPlanState }}" bind:input="onInputChange" data-type='maintenanceRequirement' />
<view wx:if="{{data.state > 1}}"> <view wx:if="{{(data.state > 1 && tabIndex == 0) ||(data.state > 2 && tabIndex == 1) }}">
<view class="mission-card-title mission-center-card-title"> <view class="mission-card-title mission-center-card-title">
<span>维修计划审批</span> <span>维修计划审批</span>
</view> </view>
@ -108,65 +108,61 @@
<van-field value="{{planApprovalTime}}" label="审批日期" readonly="{{true}}" border="{{ false }}" /> <van-field value="{{planApprovalTime}}" label="审批日期" readonly="{{true}}" border="{{ false }}" />
</block> </block>
</view> </view>
<block wx:if="{{ data.state == 4 }}"> <block wx:if="{{ (data.state > 3 && tabIndex == 0) ||(data.state > 4 && tabIndex == 1) }}">
<view class="mission-card-title mission-center-card-title"> <view class="mission-card-title mission-center-card-title">
<span>维修处理</span> <span>维修处理</span>
</view> </view>
<van-field value="{{ repair }}" extra-event-params="{{true}}" label="维修情况描述" type="textarea" placeholder="请输入" autosize border="{{ true }}" bind:input="onInputChange" data-type='repair' /> <van-field value="{{ repair }}" extra-event-params="{{true}}" label="维修情况描述" type="textarea" placeholder="请输入" autosize border="{{ isRepair }}" bind:input="onInputChange" data-type='repair' readonly="{{!isRepair}}" />
<van-cell border="{{false}}"> <van-cell border="{{false}}">
<view style="display:flex"> <view style="display:flex">
<view class="fs-cell-title" style="">完工图片</view> <view class="fs-cell-title" style="">完工图片</view>
<view class="fs-cell-content" style=""> <view class="fs-cell-content" style="">
<view class="" style="overflow-y:scroll;"> <view class="" style="overflow-y:scroll;">
<view class="" style="overflow:hidden;"> <view class="" style="overflow:hidden;">
<view class='pic' wx:for="{{repairImgs}}" wx:for-index="imgIndex" wx:for-item="imgUrl" wx:key="imgIndex"> <view wx:for="{{repairImgs}}" wx:for-index="imgIndex" wx:for-item="imgUrl" wx:key="imgIndex" style="display:inline;float:left">
<block wx:for="{{repairImgs}}" wx:for-index="imgIndex" wx:for-item="imgUrl" wx:key="imgIndex"> <image style="height:160rpx;width:160rpx;padding-right:12rpx;position:relative" src="{{imgServer+imgUrl}}" data-img="{{imgServer+imgUrl}}" data-index="{{imgIndex}}" data-key="{{imgIndex}}" data-itemindex="{{index}}" data-type="repairImgs" mode="aspectFill" bindtap="previewImg">
<image style="height:160rpx;width:160rpx;padding-right:12rpx;" src="{{imgServer+imgUrl}}" data-img="{{imgServer+imgUrl}}" data-index="{{imgIndex}}" data-key="{{imgIndex}}" data-itemindex="{{index}}" mode="aspectFill" bindtap="previewImg"> <icon wx:if="{{isRepair}}" type='cancel' class="delete-btn" data-index="{{imgIndex}}" data-type="repairImgs" catchtap="deleteImg"></icon>
<icon type='cancel' class="delete-btn" data-index="{{imgIndex}}" data-type="repairImgs" catchtap="deleteImg"></icon> </image>
</image>
</block>
</view> </view>
<!-- 用来提示用户上传图片 --> <!-- 用来提示用户上传图片 -->
<view class="" data-item="{{'item.name'}}" bindtap="chooseImg"> <image wx:if="{{repairImgs.length < 20 && isRepair}}" style="height:160rpx;width:160rpx;padding-right:24rpx;;float:left" class="upload" src="/images/upload.png" bindtap="chooseImg" data-type="repairImgs" />
<image style="height:160rpx;width:160rpx;padding-right:24rpx;" class="upload" src="/images/upload.png" />
</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</van-cell> </van-cell>
</block> </block>
<view class="mission-card-title mission-center-card-title"> <block wx:if="{{(data.state > 4 && tabIndex == 0) ||(data.state > 5 && tabIndex == 1) }}">
<span>质检验收</span> <view class="mission-card-title mission-center-card-title">
</view> <span>质检验收</span>
<van-field value="输入框已禁用" label="验收人" readonly border="{{ false }}" /> </view>
<van-cell border="{{false}}"> <van-field value="{{data.checkPerson.name}}" label="验收人" readonly border="{{ false }}" />
<view style="display:flex"> <van-cell border="{{false}}">
<view class="fs-cell-title" style="">现场图片</view> <view style="display:flex">
<view class="fs-cell-content" style=""> <view class="fs-cell-title" style="">现场图片</view>
<view class="" style="overflow-y:scroll;"> <view class="fs-cell-content" style="">
<view class="" style="overflow:hidden;"> <view class="" style="overflow-y:scroll;">
<!-- <view class='pic' wx:for="{{inspectContent[item.name].imgs}}" wx:for-item="img" wx:key="*this"> <view class="" style="overflow:hidden;">
<image class='weui-uploader__img showImg' src="{{imgUrl + img}}" data-index="{{index}}" data-item="{{item.name}}" mode="aspectFill" bindtap="previewImg"> <view wx:for="{{checkImgs}}" wx:for-index="imgIndex" wx:for-item="imgUrl" wx:key="imgIndex" style="display:inline;float:left">
<icon type='cancel' class="delete-btn" data-index="{{index}}" data-item="{{item.name}}" catchtap="deleteImg"></icon> <image style="height:160rpx;width:160rpx;padding-right:12rpx;position:relative" src="{{imgServer+imgUrl}}" data-img="{{imgServer+imgUrl}}" data-index="{{imgIndex}}" data-key="{{imgIndex}}" data-itemindex="{{index}}" data-type="checkImgs" mode="aspectFill" bindtap="previewImg">
</image> <icon wx:if="{{isCheck}}" type='cancel' class="delete-btn" data-index="{{imgIndex}}" data-type="checkImgs" catchtap="deleteImg"></icon>
</view> --> </image>
<!-- 用来提示用户上传图片 --> </view>
<view class="" data-item="{{'item.name'}}" bindtap="chooseImg"> <!-- 用来提示用户上传图片 -->
<image style="height:64px;width:64px" class="upload" src="/images/upload.png" /> <image wx:if="{{checkImgs.length < 20 && isCheck}}" style="height:160rpx;width:160rpx;padding-right:24rpx;float:left" class="upload" src="/images/upload.png" bindtap="chooseImg" data-type='checkImgs' />
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </van-cell>
</van-cell> <van-field value="{{ checkDesc }}" extra-event-params="{{true}}" label="验收意见" type="textarea" placeholder="请输入" autosize border="{{ isCheck }}" bind:input="onInputChange" data-type='checkDesc' readonly="{{!isCheck}}" />
<van-field value="{{ repair }}" extra-event-params="{{true}}" label="验收意见" type="textarea" placeholder="请输入" autosize border="{{ true }}" /> </block>
</van-cell-group> </van-cell-group>
<view style="margin:24px 16px"> <view style="margin:24px 16px">
<van-button wx:if="{{data.state == 1 || data.state == 3 || data.state == 4 }}" type="info" block style="" bindtap="confirm"> <van-button wx:if="{{isPlanState|| isRepair}}" type="info" block style="" bindtap="confirm">
提交 提交
</van-button> </van-button>
<view wx:if="{{data.state == 2}}" style="display:flex; justify-content:space-between"> <view wx:if="{{isApprove}}" style="display:flex; justify-content:space-between">
<van-button type="info" custom-style="width:calc((100vw - 32px - 24px) / 2)" bindtap="confirm" data-approve="agree"> <van-button type="info" custom-style="width:calc((100vw - 32px - 24px) / 2)" bindtap="confirm" data-approve="agree">
同意 同意
</van-button> </van-button>
@ -174,11 +170,11 @@
驳回 驳回
</van-button> </van-button>
</view> </view>
<view style="display:flex; justify-content:space-between"> <view wx:if="{{isCheck}}" style="display:flex; justify-content:space-between">
<van-button type="info" custom-style="width:calc((100vw - 32px - 24px) / 2)"> <van-button type="info" custom-style="width:calc((100vw - 32px - 24px) / 2)" bindtap="confirm" data-approve="agree">
验收通过 验收通过
</van-button> </van-button>
<van-button type="warning" custom-style="width:calc((100vw - 32px - 24px) / 2)"> <van-button type="warning" custom-style="width:calc((100vw - 32px - 24px) / 2)" bindtap="confirm" data-approve="refuse">
验收不通过 验收不通过
</van-button> </van-button>
</view> </view>

6
weapp/package/troubleshooting/shootingForm/index.wxss

@ -24,3 +24,9 @@
.fs-cell-content { .fs-cell-content {
color: var(--field-input-text-color, #323233) color: var(--field-input-text-color, #323233)
} }
.delete-btn {
position: absolute;
top: 0;
right: 4px;
}
Loading…
Cancel
Save