qa-prevention-gwj-first-app/pages/application/high-risk-work/electricity/temporary-electricity/detail.vue

479 lines
19 KiB
Vue
Raw Permalink Normal View History

2023-11-07 09:43:46 +08:00
<template>
<view >
<cu-custom bgColor="bg-gradual-blueness" :isBack="true" >
<block slot="backText">返回</block>
<block slot="content">临时用电审批</block>
</cu-custom>
<scroll-view scroll-y="false" >
<view class="form">
<view class="wui-form-list">
<view class="cu-form-group">
<view class="title">编号</view>
{{ pd.CHECK_NO }}
</view>
<view class="cu-form-group">
<view class="title">用电单位</view>
{{ pd.ELECTRICITY_UNIT }}
</view>
<view class="cu-form-group">
<view class="title">用电原因</view>
{{ pd.WORK_CONTENT }}
</view>
<view class="cu-form-group">
<view class="title">用电地点</view>
{{ pd.WORK_PLACE}}
</view>
<view class="cu-form-group" v-if="pd.WORK_LONGITUDE">
<view class="title">地点坐标经度</view>
<view>{{pd.WORK_LONGITUDE}}</view>
</view>
<view class="cu-form-group" v-if="pd.WORK_LATITUDE">
<view class="title">地点坐标纬度</view>
<view>{{pd.WORK_LATITUDE}}</view>
</view>
<view class="cu-form-group">
<view class="title">用电设备及功率</view>
{{ pd.EQUIPMENT_POWER }}
</view>
<view class="cu-form-group ">
<view class="title">用电开始时间</view>
{{pd.WORK_START_DATE}}
</view>
<view class="cu-form-group">
<view class="title">用电结束时间</view>
{{pd.WORK_END_DATE}}
</view>
<view class="cu-form-group">
<view class="title">电源接入点:</view>
{{ pd.ACCESS_POINT }}
</view>
<view class="cu-form-textarea">
<view class="cu-form-title">危险性分析:</view>
<textarea disabled v-model="pd.RISK_ANALYSIS" placeholder="请输入危险性分析"></textarea>
</view>
<view class="cu-form-group">
<view class="title">安全交底人:</view>
{{ pd.SECURITY_CONFIDANT }}
</view>
<view class="cu-form-group">
<view class="title">作业人员</view>
</view>
<view class="cu-form-group" v-if="pd.WORK_OPERATOR_NAME.length !== 0">
<uni-table border stripe emptyText="暂无更多数据" style="flex:1;margin: 20upx 0">
<uni-tr>
<uni-td>姓名</uni-td>
<uni-td>作业证号</uni-td>
</uni-tr>
<uni-tr v-for="(item,index) in pd.WORK_OPERATOR_NAME" :key="item">
<uni-td>{{ pd.WORK_OPERATOR_NAME[index] }}</uni-td>
<uni-td>{{ pd.WORK_OPERATOR_NUMBER[index] }}</uni-td>
</uni-tr>
</uni-table>
</view>
<view class="cu-form-group">
<view class="title">计量电费确认</view>
<view>
<template v-if="pd.METERING_BILL == 1"></template>
<template v-else-if="pd.METERING_BILL == 0"></template>
</view>
</view>
</view>
<view class="wui-form-list" style="padding-top: 20upx;">
<view class="wui-title" style="margin-left: 20upx;">
<text class="text-semi">安全防护措施</text>
</view>
<view class="wui-table" style="padding: 0 20upx;">
<uni-table name='measuresList' border stripe emptyText="暂无更多数据" >
<!-- 表头行 -->
<uni-tr>
<uni-th align="center" style="font-weight: bold;">主要安全措施</uni-th>
<uni-th align="center" style="font-weight: bold;width: 100px">操作</uni-th>
</uni-tr>
<uni-tr v-for="(item,index) in measuresList" :key="item.BUS_ELECTRICITY_MEASURES_ID">
<uni-td>{{item.PROTECTIVE_MEASURES}}</uni-td>
<uni-td align="center">
<text class="wui-pl10" v-if="item.STATUS=='-1'"></text>
<text class="wui-pl10" v-if="item.STATUS=='1'"></text>
<text class="wui-pl10" v-if="item.STATUS=='2'"></text>
</uni-td>
</uni-tr>
</uni-table>
</view>
<view class="cu-form-textarea" style="border: none;">
<view class="cu-form-title">其他措施:</view>
<textarea maxlength="255" disabled v-model="pd.OTHER_PROTECTIVE_MEASURES"></textarea>
</view>
</view>
<view class="wui-form-list">
<view class="wui-sign">
<view class="title">安全措施确认人签字</view>
<!-- <button v-if="!forbidEdit" class="cu-btn bg-green shadow" @tap="showModal" data-target="Modal"></button>-->
</view>
<view class="wui-sign-box" v-show="(imgList && imgList.length > 0) || (initImgList && initImgList.length > 0)">
<view class="sign-title">
签字照片
</view>
<view class="wui-sign-cotent" v-if="imgList && imgList.length > 0">
<view class="sign-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" data-type="0" :data-url="imgList[index].filePath">
<image :src="imgList[index].filePath" mode="aspectFit"></image>
</view>
</view>
<view class="wui-sign-cotent" v-else-if="initImgList && initImgList.length > 0">
<view class="sign-img" v-for="(item,index) in initImgList" :key="index" @tap="ViewImage" data-type="0" :data-url="initImgList[index].filePath">
<image :src="initImgList[index].filePath" mode="aspectFit"></image>
</view>
</view>
</view>
<view class="cu-modal" :class="modalName=='Modal'?'show':''">
<writing-board @confirm="subCanvas" @cancel="hideModal"></writing-board>
</view>
</view>
<view class="wui-form-list">
<view class="wui-sign">
<view class="title">作业单位</view>
<!-- <button v-if="!forbidEdit" class="cu-btn bg-green shadow" @tap="showModal" data-target="workModal"></button>-->
</view>
<view class="wui-sign-box" v-show="(workImgList && workImgList.length > 0) || (initWorkImgList && initWorkImgList.length > 0)">
<view class="sign-title">
签字照片
</view>
<view class="wui-sign-cotent" v-if="workImgList && workImgList.length > 0">
<view class="sign-img" v-for="(item,index) in workImgList" :key="index" @tap="ViewImage" data-type="0" :data-url="workImgList[index].filePath">
<image :src="workImgList[index].filePath" mode="aspectFit"></image>
</view>
</view>
<view class="wui-sign-cotent" v-else-if="initWorkImgList && initWorkImgList.length > 0">
<view class="sign-img" v-for="(item,index) in initWorkImgList" :key="index" @tap="ViewImage" data-type="0" :data-url="initWorkImgList[index].filePath">
<image :src="initWorkImgList[index].filePath" mode="aspectFit"></image>
</view>
</view>
</view>
<view class="cu-modal" :class="modalName=='workModal'?'show':''">
<writing-board @confirm="workSubCanvas" @cancel="hideModal"></writing-board>
</view>
</view>
<view class="wui-form-list">
<view class="wui-sign">
<view class="title">运维保障部门</view>
<!-- <button class="cu-btn bg-green shadow" @tap="showModal" data-target="ConfirmationModal">手写签字</button>-->
</view>
<view class="wui-sign-box" v-show="(ConfirmationImgList && ConfirmationImgList.length > 0) || (initConfirmationImgList && initConfirmationImgList.length > 0)">
<view class="sign-title">
签字照片
</view>
<view class="wui-sign-cotent" v-if="ConfirmationImgList && ConfirmationImgList.length > 0">
<view class="sign-img" v-for="(item,index) in ConfirmationImgList" :key="index" @tap="ViewImage" data-type="0" :data-url="ConfirmationImgList[index].filePath">
<image :src="ConfirmationImgList[index].filePath" mode="aspectFit"></image>
</view>
</view>
<view class="wui-sign-cotent" v-else-if="initConfirmationImgList && initConfirmationImgList.length > 0">
<view class="sign-img" v-for="(item,index) in initConfirmationImgList" :key="index" @tap="ViewImage" data-type="0" :data-url="initConfirmationImgList[index].filePath">
<image :src="initConfirmationImgList[index].filePath" mode="aspectFit"></image>
</view>
</view>
</view>
<view class="cu-modal" :class="modalName=='ConfirmationModal'?'show':''">
<writing-board @confirm="ConfirmationSubCanvas" @cancel="hideModal"></writing-board>
</view>
</view>
<view class="wui-form-list">
<view class="wui-sign">
<view class="title">审批单位</view>
<button class="cu-btn bg-green shadow" @tap="showModal" data-target="ApprovalUnitModal">手写签字</button>
</view>
<view class="wui-sign-box" v-show="(ApprovalUnitImgList && ApprovalUnitImgList.length > 0) || (initApprovalUnitImgList && initApprovalUnitImgList.length > 0)">
<view class="sign-title">
签字照片
</view>
<view class="wui-sign-cotent" v-if="ApprovalUnitImgList && ApprovalUnitImgList.length > 0">
<view class="sign-img" v-for="(item,index) in ApprovalUnitImgList" :key="index" @tap="ViewImage" data-type="0" :data-url="ApprovalUnitImgList[index].filePath">
<image :src="ApprovalUnitImgList[index].filePath" mode="aspectFit"></image>
</view>
</view>
<view class="wui-sign-cotent" v-else-if="initApprovalUnitImgList && initApprovalUnitImgList.length > 0">
<view class="sign-img" v-for="(item,index) in initApprovalUnitImgList" :key="index" @tap="ViewImage" data-type="0" :data-url="initApprovalUnitImgList[index].filePath">
<image :src="initApprovalUnitImgList[index].filePath" mode="aspectFit"></image>
</view>
</view>
</view>
<view class="cu-modal" :class="modalName=='ApprovalUnitModal'?'show':''">
<writing-board @confirm="ApprovalUnitSubCanvas" @cancel="hideModal"></writing-board>
</view>
</view>
</view>
<view class="cu-bar btn-group" style="margin-top: 30upx;">
<button class="cu-btn bg-blue margin-tb-sm lg" @click="$noMultipleClicks(goSubmit,'-1')"></button>
<button class="cu-btn bg-green margin-tb-sm lg" @click="$noMultipleClicks(goSubmit,'3')"></button>
</view>
<view class="padding flex flex-direction"></view>
</scroll-view>
</view>
</template>
<script>
import {
basePath,corpinfoId,loginUser,formatDate,loginSession,baseImgPath
} from '@/common/tool.js';
import writingBoard from "@/components/writing-board/writing-board.vue"
export default {
components: {
writingBoard
},
data() {
return {
baseImgPath:baseImgPath,
isUps:false,
forbidEdit:true,// 禁止修改
noClick:true,
treeNode:[],//部门下拉数据
pd:{
WORK_OPERATOR_ID: [],
WORK_OPERATOR_NAME: [],
WORK_OPERATOR_NUMBER: []
},// 数据
measuresList:[],
todayDate:'',
modalName:null,
imgList:[],// 上传时使用照片
workImgList:[],// 上传时使用照片
ConfirmationImgList:[], // 上传时使用照片
ApprovalUnitImgList:[], // 上传时使用照片
assureUserList:[],
assureindex:-1,
approveUserList:[],
approveindex:-1,
initImgList:[], // 初始化安全措施照片
initWorkImgList:[], // 初始化作业单位
initConfirmationImgList:[], // 初始化运维保障部门照片
initApprovalUnitImgList:[], // 初始化审批单位片
meteringBillList: [
{
NAME: '是',
ID: '1',
},
{
NAME: '否',
ID: '0',
},
],
metering_bill_index: -1,
}
},
onLoad(event){
this.todayDate = formatDate(new Date(), 'yyyy-MM-dd hh:mm');
this.pd.ELECTRICITY_ID = event.ELECTRICITY_ID;
this.getData();
// 初始化现场作业负责人
loginSession();
},
methods: {
getData() {
var _this = this;
uni.showLoading({
title: '请稍候'
})
uni.request({
url: basePath + '/app/electricity/goEdit',
method: 'POST',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
ELECTRICITY_ID: _this.pd.ELECTRICITY_ID,
},
success: (res) => {
if ("success" === res.data.result) {
uni.hideLoading();
console.log(res.data.pd)
_this.pd = res.data.pd; //参数map
_this.initImgList.push({filePath:baseImgPath + _this.pd.CONFIRM_USER_SIGNER_PATH})
_this.initWorkImgList.push({filePath:baseImgPath + _this.pd.WORK_USER_SIGNER_PATH})
_this.initConfirmationImgList.push({filePath:baseImgPath + _this.pd.ASSURE_USER_SIGNER_PATH})
_this.measuresList = res.data.measuresList
if (!_this.pd.WORK_OPERATOR_ID) {
_this.$set(_this.pd, 'WORK_OPERATOR_ID', [])
} else {
_this.pd.WORK_OPERATOR_ID = _this.pd.WORK_OPERATOR_ID.split(',')
}
if (!_this.pd.WORK_OPERATOR_NAME) {
_this.$set(_this.pd, 'WORK_OPERATOR_NAME', [])
} else {
_this.pd.WORK_OPERATOR_NAME = _this.pd.WORK_OPERATOR_NAME.split(',')
}
if (!_this.pd.WORK_OPERATOR_NUMBER) {
_this.$set(_this.pd, 'WORK_OPERATOR_NUMBER', [])
} else {
_this.pd.WORK_OPERATOR_NUMBER = _this.pd.WORK_OPERATOR_NUMBER.split(',')
}
if(_this.pd.APPLY_STATUS < 1){
_this.forbidEdit = false;
}
} else if ("exception" === res.data.result) {
uni.showToast({
title: '错误',
duration: 2000
});
}
},
fail: (res) => {
uni.hideLoading();
uni.showToast({
title: '错误',
duration: 2000
});
}
});
},
goSubmit(STATUS){
var _this = this;
let required = true
if(STATUS == '3'){
if(!this.pd.METERING_BILL){
uni.showToast({
icon: 'none',
title: '请选择计量电费确认',
duration: 1500
});
required = false
}
if(this.ApprovalUnitImgList.length == 0){
uni.showToast({
icon: 'none',
title: '审批单位未进行签字',
duration: 1500
});
required = false
}
if (!required) {
return
}
uni.showLoading({
title: '请稍候'
})
const formData={}
formData.OPERATOR=loginUser.USER_ID
formData.ACTION_USER=loginUser.NAME
formData.APPLY_STATUS=STATUS
formData.CHECK_STATUS='0' /*待验收*/
formData.ELECTRICITY_ID=this.pd.ELECTRICITY_ID
formData.SIGNER_TIME=formatDate(new Date(), 'yyyy-MM-dd hh:mm');
// formData.ACCESS_POINT=this.pd.ACCESS_POINT
// formData.RISK_ANALYSIS=this.pd.RISK_ANALYSIS
// formData.METERING_BILL=this.pd.METERING_BILL
uni.uploadFile({
url: basePath+'/app/electricity/editStatus',
filePath:this.ApprovalUnitImgList[0].filePath,
name: 'FILES',
formData: formData,
success: (res) => {
uni.showToast({
icon:'none',
title: '保存成功',
duration: 2000
});
_this.goback()
},
fail: (err) => {
uni.hideLoading();
uni.showModal({
content: err.errMsg,
showCancel: false
});
}
})
}else {
uni.showLoading({
title: '请稍候'
})
uni.request({
url: basePath + '/app/electricity/editStatus',
method: 'POST',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
ELECTRICITY_ID: _this.pd.ELECTRICITY_ID,
APPLY_STATUS:'-1',
OPERATOR:loginUser.USER_ID,
ACTION_USER:loginUser.NAME
},
success: (res) => {
uni.showToast({
icon:'none',
title: '保存成功',
duration: 2000
});
_this.goback()
},
fail: (res) => {
uni.hideLoading();
uni.showToast({
title: '错误',
duration: 2000
});
}
});
}
},
/*
*手写板
*/
showModal(e) {
this.modalName = e.currentTarget.dataset.target
},
hideModal(e) {
this.modalName = null
},
//完成
subCanvas(e) {
this.imgList.splice(0,this.imgList.length);
this.imgList.push(e);
this.pd.SIGNER_TIME = formatDate(new Date(), 'yyyy-MM-dd hh:mm');
this.hideModal()
},
workSubCanvas(e) {
this.workImgList.splice(0,this.workImgList.length);
this.workImgList.push(e);
this.pd.WORK_SIGNER_TIME = formatDate(new Date(), 'yyyy-MM-dd hh:mm');
this.hideModal()
},
ConfirmationSubCanvas(e) {
this.ConfirmationImgList.splice(0,this.ConfirmationImgList.length);
this.ConfirmationImgList.push(e);
this.pd.CONFIRMATION_SIGNER_TIME = formatDate(new Date(), 'yyyy-MM-dd hh:mm');
this.hideModal()
},
ApprovalUnitSubCanvas(e) {
this.ApprovalUnitImgList.splice(0,this.ApprovalUnitImgList.length);
this.ApprovalUnitImgList.push(e);
this.pd.APPROVAL_UNIT_SIGNER_TIME = formatDate(new Date(), 'yyyy-MM-dd hh:mm');
this.hideModal()
},
ViewImage(e) {
let files =[];
files.push(e.currentTarget.dataset.url)
uni.previewImage({
urls: files,
current: e.currentTarget.dataset.url
});
},
meteringBillChange(e){
this.metering_bill_index = e.detail.value;
this.$set(this.pd,'METERING_BILL_NAME',this.meteringBillList[e.detail.value].NAME)
this.$set(this.pd,'METERING_BILL',this.meteringBillList[e.detail.value].ID)
},
goback(){
var pages = getCurrentPages(); // 获取当前页面栈
var prePage = pages[pages.length - 2]; // 上二级页面
prePage.$vm.initflag = true; // A 页面 init方法 为true
uni.navigateBack({delta: 1});
uni.hideLoading();
},
}
}
</script>
<style>
</style>