Browse Source

问题处理计划制定、审批

master
巴林闲侠 2 years ago
parent
commit
8c6751ef3d
  1. 126
      weapp/package/troubleshooting/shootingForm/index.js
  2. 4
      weapp/package/troubleshooting/shootingForm/index.json
  3. 69
      weapp/package/troubleshooting/shootingForm/index.wxml

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

@ -9,12 +9,16 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
imgServer: getApp().globalData.imgUrl,
userInfo: wx.getStorageSync("userInfo"),
data: {}, data: {},
strucFocusUser: {}, strucFocusUser: {},
focusPerson: [], focusPerson: [],
shootingid: '', shootingid: '',
pointItemCollapseActiveNames: undefined,
maintenancePersonIndex: undefined, maintenancePersonIndex: undefined,
maintenancePersonId: null, maintenancePersonId: null,
maintenancePersonDepartmentShow: '',
maintenanceRequirement: '', maintenanceRequirement: '',
qualityPersonIndex: undefined, qualityPersonIndex: undefined,
planStartTimePopupShow: false, planStartTimePopupShow: false,
@ -24,10 +28,13 @@ Page({
planEndTime: '', planEndTime: '',
planEndTimeShow: '', planEndTimeShow: '',
planApproval: '', planApproval: '',
planApprovalPerson: '',
planApprovalTime: '',
repair: '', repair: '',
// 表单控制 // 表单控制
isPlanState: false, isPlanState: false,
isApprove: false,
}, },
/** /**
@ -47,15 +54,31 @@ Page({
).then(res => { ).then(res => {
console.log(res, 222); console.log(res, 222);
const [issue, strucUser] = res const [issue, strucUser] = res
this.setData({ const nextData = {
data: { ...issue,
...issue, PatrolRecord: {
PatrolRecord: { ...issue.PatrolRecord,
...issue.PatrolRecord, inspectionTime: moment(issue.PatrolRecord.inspectionTime).format('YYYY-MM-DD HH:mm:ss'),
inspectionTime: moment(issue.PatrolRecord.inspectionTime).format('YYYY-MM-DD HH:mm:ss') points: {
...issue.PatrolRecord.points,
inspectContent: (() => {
let inspectContent = []
for (let k in issue.PatrolRecord.points.inspectContent) {
inspectContent.push({
...issue.PatrolRecord.points.inspectContent[k],
itemName: k
})
}
return inspectContent
})()
} }
}, }
isPlanState: issue.state == 1 || issue.state == 3 }
console.log(nextData);
this.setData({
data: nextData,
isPlanState: issue.state == 1 || issue.state == 3,
isApprove: issue.state == 2
}) })
this.setData({ this.setData({
strucFocusUser: { strucFocusUser: {
@ -66,12 +89,38 @@ Page({
this.setData({ this.setData({
focusPerson: focusPerson focusPerson: focusPerson
}) })
if (issue.state > 1) {
let maintenancePersonIndex = focusPerson.findIndex(f => f.id == issue.repairPerson.id)
console.log(issue.startTime, moment(issue.startTime).format('YYYY-MM-DD HH:mm:ss'));
this.setData({
maintenancePersonIndex: maintenancePersonIndex,
maintenancePersonDepartmentShow: focusPerson[maintenancePersonIndex].department.name,
qualityPersonIndex: focusPerson.findIndex(f => f.id == issue.checkPerson.id),
planStartTime: moment(issue.startTime).unix(),
planStartTimeShow: moment(issue.startTime).format('YYYY-MM-DD HH:mm:ss'),
planEndTimeShow: moment(issue.endTime).format('YYYY-MM-DD HH:mm:ss'),
maintenanceRequirement: issue.repairAsk
})
}
if (issue.state > 2) {
this.setData({
planApproval: issue.approveOpinion,
planApprovalPerson: issue.approvePerson ? issue.approvePerson.name : '',
planApprovalTime: issue.approveDate ? moment(issue.approveDate).format('YYYY-MM-DD HH:mm:ss') : '',
})
}
}) })
} else { } else {
} }
}, },
onPointItemCollapseActiveChange (event) {
this.setData({
pointItemCollapseActiveNames: event.detail,
});
},
onMaintenancePersonPopupChange (e) { onMaintenancePersonPopupChange (e) {
console.log(e); console.log(e);
if (e.target.dataset.type == 'zhijian') { if (e.target.dataset.type == 'zhijian') {
@ -79,11 +128,12 @@ Page({
qualityPersonIndex: e.detail.value qualityPersonIndex: e.detail.value
}) })
} else { } else {
let selectedUser = this.data.focusPerson[e.detail.value]
this.setData({ this.setData({
maintenancePersonIndex: e.detail.value maintenancePersonIndex: e.detail.value,
maintenancePersonDepartmentShow: selectedUser ? selectedUser.department.name : ''
}) })
} }
}, },
showPlanStartTimePopup () { showPlanStartTimePopup () {
@ -132,6 +182,25 @@ Page({
}) })
}, },
onInputChange (e) {
console.log(e);
this.setData({
[e.target.dataset.type]: e.detail.value
})
},
// 预览图片
previewImg: function (e) {
console.log(e);
const { index, itemindex } = e.currentTarget.dataset
const imgs = this.data.data.PatrolRecord.points.inspectContent[itemindex].imgs;
const newImgs = imgs.map(i => this.data.imgServer + i);
wx.previewImage({
current: newImgs[index],
urls: newImgs
})
},
// 上传图片 // 上传图片
chooseImg: function (e) { // 这里是选取图片的方法 chooseImg: function (e) { // 这里是选取图片的方法
const that = this; const that = this;
@ -241,18 +310,47 @@ Page({
}, },
confirm (e) { confirm (e) {
console.log(e);
const { approve } = e.target.dataset
const { state } = this.data.data const { state } = this.data.data
const {
shootingid, focusPerson,
maintenancePersonIndex, maintenancePersonDepartmentShow, qualityPersonIndex, planStartTime, planEndTime, maintenanceRequirement,
userInfo, planApproval,
} = this.data
let nextState = '' let nextState = ''
let confirmData = {} let confirmData = {}
if (state == 1) { if (state == 1 || state == 3) {
nextState = 2 nextState = 2
confirmData = { confirmData = {
...confirmData, ...confirmData,
repairPerson: focusPerson[maintenancePersonIndex],
repairUnit: maintenancePersonDepartmentShow,
checkPerson: focusPerson[qualityPersonIndex],
startTime: moment(planStartTime).format(),
endTime: moment(planEndTime).format(),
repairAsk: maintenanceRequirement,
}
} else if (state == 2) {
confirmData = {
...confirmData,
approveOpinion: planApproval,
approvePerson: userInfo,
approveDate: moment().format(),
}
if (approve == 'agree') {
nextState = 4
} else {
nextState = 3
} }
} }
Request.put(editPatrolRecordIssueHandle(this.data.shootingid), confirmData).then(res => { Request.put(editPatrolRecordIssueHandle(shootingid), {
...confirmData,
state: nextState,
}).then(res => {
// wx.redirectTo({
// url: '/package/troubleshooting/index'
// })
}) })
}, },

4
weapp/package/troubleshooting/shootingForm/index.json

@ -10,6 +10,8 @@
"van-picker": "@vant/weapp/picker/index", "van-picker": "@vant/weapp/picker/index",
"van-popup": "@vant/weapp/popup/index", "van-popup": "@vant/weapp/popup/index",
"van-icon": "@vant/weapp/icon/index", "van-icon": "@vant/weapp/icon/index",
"van-datetime-picker": "@vant/weapp/datetime-picker/index" "van-datetime-picker": "@vant/weapp/datetime-picker/index",
"van-collapse": "@vant/weapp/collapse/index",
"van-collapse-item": "@vant/weapp/collapse-item/index"
} }
} }

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

@ -11,19 +11,30 @@
<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="输入框已禁用" label="{{data.PatrolRecord.points.itemData.name}}" readonly border="{{ false }}" /> <van-field value="{{data.PatrolRecord.points.itemData.name}}" label="点位" readonly accordion border="{{ false }}" />
<van-field value="{{data.PatrolRecord.points.itemData}}" label="检查项" readonly border="{{ false }}" /> <van-collapse wx:if="{{data.PatrolRecord.points.inspectContent}}" value="{{ pointItemCollapseActiveNames }}" bind:change="onPointItemCollapseActiveChange" border="{{false}}">
<van-field value="输入框已禁用" label="异常等级" readonly border="{{ false }}" /> <block wx:for="{{data.PatrolRecord.points.inspectContent}}" wx:key="index">
<van-field value="输入框已禁用" label="问题描述" readonly border="{{ false }}" /> <van-collapse-item name="{{item.itemName}}" border="{{false}}">
<van-cell border="{{false}}"> <view slot="title">
<view style="display:flex"> <van-field value="{{item.itemName}}" label="检查项" readonly border="{{ false }}" />
<view class="fs-cell-title" style="">现场照片</view> </view>
<view class="fs-cell-content" style=""> <view slot="">
123 <van-field value="1" label="异常等级" readonly border="{{ false }}" />
<!-- <image class='weui-uploader__img showImg' src="{{imgUrl + item}}" data-img="{{imgUrl + item}}" data-index="{{index}}" data-key="{{key}}" mode="aspectFill" bindtap="previewImg"></image> --> <van-field value="2" label="问题描述" readonly border="{{ false }}" />
</view> <van-cell border="{{false}}">
</view> <view style="display:flex">
</van-cell> <view class="fs-cell-title" style="">现场照片</view>
<view class="fs-cell-content" style="">
<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>
</block>
</view>
</view>
</van-cell>
</view>
</van-collapse-item>
</block>
</van-collapse>
<view class="mission-card-title mission-center-card-title"> <view class="mission-card-title mission-center-card-title">
<span>维修计划信息</span> <span>维修计划信息</span>
</view> </view>
@ -33,19 +44,19 @@
<picker style="width:100%;text-align:left" disabled="{{!isPlanState}}" bindchange="onMaintenancePersonPopupChange" data-type='weixiu' value="{{0}}" range="{{focusPerson}}" range-key="name"> <picker style="width:100%;text-align:left" disabled="{{!isPlanState}}" bindchange="onMaintenancePersonPopupChange" data-type='weixiu' value="{{0}}" range="{{focusPerson}}" range-key="name">
<view class="fs-cell-content" style="width:100%"> <view class="fs-cell-content" style="width:100%">
{{maintenancePersonIndex||maintenancePersonIndex==0?focusPerson[maintenancePersonIndex].name:'请选择'}} {{maintenancePersonIndex||maintenancePersonIndex==0?focusPerson[maintenancePersonIndex].name:'请选择'}}
<van-icon name="arrow" style="float:right;position:relative; top:4px" /> <van-icon wx:if="{{isPlanState}}" name="arrow" style="float:right;position:relative; top:4px" />
</view> </view>
</picker> </picker>
</view> </view>
</van-cell> </van-cell>
<van-field value="xxxx" label="维修单位" placeholder="" readonly="{{!isPlanState}}" border="{{ !isPlanState }}" /> <van-field value="{{maintenancePersonDepartmentShow}}" label="维修单位" placeholder="" readonly="{{true}}" border="{{ false }}" />
<van-cell> <van-cell>
<view style="display:flex"> <view style="display:flex">
<view class="fs-cell-title" style="">质检人</view> <view class="fs-cell-title" style="">质检人</view>
<picker style="width:100%;text-align:left" disabled="{{!isPlanState}}" bindchange="onMaintenancePersonPopupChange" data-type='zhijian' value="{{qualityPersonIndex}}" range="{{focusPerson}}" range-key="name"> <picker style="width:100%;text-align:left" disabled="{{!isPlanState}}" bindchange="onMaintenancePersonPopupChange" data-type='zhijian' value="{{qualityPersonIndex}}" range="{{focusPerson}}" range-key="name">
<view class="fs-cell-content" style="width:100%"> <view class="fs-cell-content" style="width:100%">
{{qualityPersonIndex||qualityPersonIndex==0?focusPerson[qualityPersonIndex].name:'请选择'}} {{qualityPersonIndex||qualityPersonIndex==0?focusPerson[qualityPersonIndex].name:'请选择'}}
<van-icon name="arrow" style="float:right;position:relative; top:4px" /> <van-icon wx:if="{{isPlanState}}" name="arrow" style="float:right;position:relative; top:4px" />
</view> </view>
</picker> </picker>
</view> </view>
@ -86,19 +97,21 @@
</van-popup> </van-popup>
</view> </view>
</van-cell> </van-cell>
<van-field value="{{ maintenanceRequirement }}" label="维修要求" type="textarea" placeholder="请输入" autosize readonly="{{!isPlanState}}" border="{{ !isPlanState }}" /> <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}}">
<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="{{ planApproval }}" label="审批意见" type="textarea" placeholder="请输入" autosize border="{{ true }}" /> <van-field value="{{ planApproval }}" label="审批意见" type="textarea" placeholder="请输入" extra-event-params="{{true}}" autosize border="{{ isApprove }}" readonly="{{!isApprove}}" bind:input="onInputChange" data-type='planApproval' />
<van-field value="输入框已禁用" label="审批人" readonly border="{{ false }}" /> <block wx:if="{{data.state > 2}}">
<van-field value="输入框已禁用" label="审批日期" readonly border="{{ false }}" /> <van-field value="{{planApprovalPerson}}" label="审批人" readonly="{{true}}" border="{{ false }}" />
<van-field value="{{planApprovalTime}}" label="审批日期" readonly="{{true}}" border="{{ false }}" />
</block>
</view> </view>
<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 }}" label="维修情况描述" type="textarea" placeholder="请输入" autosize border="{{ true }}" /> <van-field value="{{ repair }}" extra-event-params="{{true}}" label="维修情况描述" type="textarea" placeholder="请输入" autosize border="{{ true }}" />
<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>
@ -112,7 +125,7 @@
</view> --> </view> -->
<!-- 用来提示用户上传图片 --> <!-- 用来提示用户上传图片 -->
<view class="" data-item="{{'item.name'}}" bindtap="chooseImg"> <view class="" data-item="{{'item.name'}}" bindtap="chooseImg">
<image style="height:64px;width:64px" class="upload" src="/images/upload.png" /> <image style="height:160rpx;width:160rpx;padding-right:24rpx;" class="upload" src="/images/upload.png" />
</view> </view>
</view> </view>
</view> </view>
@ -143,15 +156,17 @@
</view> </view>
</view> </view>
</van-cell> </van-cell>
<van-field value="{{ repair }}" label="验收意见" type="textarea" placeholder="请输入" autosize border="{{ true }}" /> <van-field value="{{ repair }}" extra-event-params="{{true}}" label="验收意见" type="textarea" placeholder="请输入" autosize border="{{ true }}" />
</van-cell-group> </van-cell-group>
<view style="margin:24px 16px"> <view style="margin:24px 16px">
<van-button type="info" block style="" bindtap="confirm">提交</van-button> <van-button wx:if="{{data.state == 1 || data.state == 3 }}" type="info" block style="" bindtap="confirm">
<view style="display:flex; justify-content:space-between"> 提交
<van-button type="info" custom-style="width:calc((100vw - 32px - 24px) / 2)"> </van-button>
<view wx:if="{{data.state == 2}}" 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> </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>

Loading…
Cancel
Save