qa-prevention-gwj-first-app/pages/application/eight-assignments/hotwork/unit-principal/detail.vue

549 lines
24 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>
<view class="form">
<view class="wui-form-list">
<view class="cu-form-group">
<view class="title">申请单位</view>
{{ form.APPLY_DEPARTMENT_NAME }}
</view>
<view class="cu-form-group">
<view class="title">申请办理人</view>
{{ form.APPLY_USER_NAME }}
</view>
<view class="cu-form-group">
<view class="title">作业编号</view>
{{form.JOB_NUMBER}}
</view>
<view class="cu-form-group">
<view class="title">申请日期</view>
{{ form.APPLICATION_DATE }}
</view>
<view class="cu-form-group">
<view class="title">作业类型</view>
{{ form.JOB_TYPE_NAME }}
</view>
<view class="cu-form-group">
<view class="title">动火部位</view>
{{form.HOT_WORK_POSITION}}
</view>
<view class="cu-form-group">
<view class="title">动火方法</view>
{{ form.HOT_WORK_METHOD_NAME}}
</view>
<view class="cu-form-group">
<view class="title">动火等级</view>
{{ form.HOT_WORK_LEVEL_NAME}}
</view>
<view class="cu-form-group">
<view class="title">动火开始时间</view>
{{ form.HOT_WORK_TIME_START }}
</view>
<view class="cu-form-group">
<view class="title">动火结束时间</view>
{{ form.HOT_WORK_TIME_END }}
</view>
<view class="cu-form-group" v-if="form.WORK_LONGITUDE">
<view class="title">作业地点经度</view>
<view>{{form.WORK_LONGITUDE}}</view>
</view>
<view class="cu-form-group" v-if="form.WORK_LATITUDE">
<view class="title">作业地点纬度</view>
<view>{{form.WORK_LATITUDE}}</view>
</view>
<view class="cu-form-group">
<view class="title">作业内容</view>
{{form.JOB_CONTENT}}
</view>
</view>
<view class="wui-form-list">
<view class="cu-form-group">
<view class="title">现场负责人部门</view>
{{form.SITE_LEADER_DEPARTMENT_NAME}}
</view>
<view class="cu-form-group">
<view class="title">现场负责人</view>
{{form.SITE_LEADER_NAME}}
</view>
<view class="cu-form-group">
<view class="title">现场负责人手机号</view>
{{form.SITE_LEADER_PHONE}}
</view>
</view>
<view class="wui-form-list">
<view class="cu-form-group">
<view class="title">动火操作人</view>
<uni-table border stripe emptyText="暂无更多数据" style="flex:1;margin: 20upx 0">
<uni-tr></uni-tr>
<uni-tr v-for="item in form.HOT_WORK_OPERATOR_NAME" :key="item">
<uni-td>{{ item }}</uni-td>
</uni-tr>
</uni-table>
</view>
<view class="cu-form-group">
<view class="title">动火监火人</view>
{{form.SUPERVISOR_OF_HOT_WORK_UNIT}}
</view>
</view>
<view class="wui-form-list">
<view style="padding: 20upx">
<uni-table border stripe emptyText="暂无更多数据">
<uni-tr>
<uni-th align="center" style="font-weight: bold;width: 100upx">序号</uni-th>
<uni-th align="center" style="font-weight: bold">主要安全措施</uni-th>
<uni-th align="center" style="font-weight: bold;width: 200upx">操作</uni-th>
</uni-tr>
<uni-tr v-for="(item,index) in measureList" :key="item.PROTECTIVE_MEASURES">
<uni-td>{{ index + 1 }}</uni-td>
<uni-td>
<view style="margin-bottom: 20upx;">
{{item.PROTECTIVE_MEASURES}}
</view>
<view class="wui-border"
v-if="item.QUESTION1 || item.QUESTION2 || item.QUESTION3 || item.QUESTION4">
<view class="cu-form-group" v-if="item.QUESTION1">
<input name="input" v-model="item.ANSWER1" placeholder="请输入"></input>
</view>
<view class="cu-form-group" v-if="item.QUESTION2">
<view class="title">{{item.QUESTION2}}</view>
<input name="input" v-model="item.ANSWER2" placeholder="请输入"></input>
</view>
<view class="cu-form-group" v-if="item.QUESTION3">
<view class="title">{{item.QUESTION3}}</view>
<input name="input" v-model="item.ANSWER3" placeholder="请输入"></input>
</view>
<view class="cu-form-group" v-if="item.QUESTION4">
<view class="title">{{item.QUESTION4}}</view>
<input name="input" v-model="item.ANSWER4" placeholder="请输入"></input>
</view>
</view>
</uni-td>
<uni-td>
<radio-group @change="changeRadioGroup($event,index)">
<radio value="1"/>
<radio value="0"/>
不符合
</radio-group>
</uni-td>
</uni-tr>
</uni-table>
</view>
</view>
<view class="wui-form-list">
<view class="cu-form-group">
<view class="title">其他安全措施</view>
<button class="cu-btn round bg-blue" @click="addOther"></button>
</view>
<view class="ace-content" v-show="oldOtherMeasure && oldOtherMeasure.length > 0">
<view class="add_pard_item" v-for="(item,index) of oldOtherMeasure">
<!-- <view v-if="!forbidEdit" class="add_pard_del" @click="removeOldMeasure(index)">
<text class="cuIcon-roundclosefill text-red f40"></text>
</view> -->
<view class="cu-form-textarea">
<textarea disabled="true" placeholder="请输入其他安全措施..." v-model="item.CONTENT"></textarea>
</view>
</view>
</view>
<view class="ace-content" v-show="otherMeasure && otherMeasure.length > 0">
<view class="add_pard_item" v-for="(item,index) of otherMeasure">
<view class="add_pard_del" @click="removeMeasure(index)">
<text class="cuIcon-roundclosefill text-red f40"></text>
</view>
<view class="cu-form-textarea">
<textarea placeholder="请输入其他安全措施..." v-model="otherMeasure[index]"></textarea>
</view>
</view>
</view>
</view>
<view class="wui-form-list" v-if="form.IS_GAS_TESTING =='1'">
<view class="wui-form-list">
<view class="cu-form-group">
<view class="title">气体分析人</view>
{{form.GAS_TESTING_USER_NAME}}
<button class="cu-btn bg-blue margin-tb-sm sm"
@click.stop="$noMultipleClicks(goToGasDelay,form.HOTWORKAPPLICATION_ID)">气体检测信息
</button>
</view>
</view>
</view>
</view>
<view class="cu-bar btn-group" style="margin-top: 30upx;">
<button class="cu-btn bg-grey margin-tb-sm lg" @click="confirmType(1)"></button>
<button class="cu-btn bg-green margin-tb-sm lg" @click="confirmType(2)"></button>
</view>
<view class="padding flex flex-direction"></view>
<view :class="['cu-modal',{'show':modalShow}]">
<sign @confirm="subCanvas" @cancel="modalShow = false" v-if="submitType === 2"></sign>
<view class="cu-dialog" v-if="submitType === 1">
<view class="cu-bar bg-white justify-end">
<view class="content">打回意见</view>
<view class="action" @tap="modalShow = false">
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view>
<view class="wrapper">
<view class="handCenter">
<textarea class="textarea" v-model="form.OPINION" placeholder="请输入打回意见"></textarea>
</view>
</view>
</view>
<view class="cu-bar bg-white justify-end">
<view class="action">
<button class="cu-btn line-green text-green" @click="modalShow = false">取消</button>
<button class="cu-btn bg-green margin-left" @click="$noMultipleClicks(goSubmit)"></button>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {
basePath,
loginUser,
loginSession,
loginUserId,
corpinfoId
} from '@/common/tool.js';
import sign from '@/components/sign/sign.vue';
export default {
components: {
sign,
},
data() {
return {
noClick: true,
form: {
HOTWORKAPPLICATION_ID: '',
APPLY_DEPARTMENT_NAME: '',
APPLY_USER_NAME: '',
JOB_NUMBER: '',
APPLICATION_DATE: '',
JOB_TYPE_INDEX: '',
JOB_TYPE_ID: '',
JOB_TYPE_NAME: '',
HOT_WORK_POSITION: '',
HOT_WORK_METHOD_ID: '',
HOT_WORK_METHOD_NAME: '',
HOT_WORK_LEVEL_INDEX: '',
HOT_WORK_LEVEL_ID: '',
HOT_WORK_LEVEL_NAME: '',
HOT_WORK_APPLICATION_DEPARTMENT_ID: '',
HOT_WORK_APPLICATION_DEPARTMENT_NAME: '',
DEPARTMENT_PERSONNEL_ID: '',
DEPARTMENT_PERSONNEL_NAME: '',
JOB_CONTENT: '',
SITE_LEADER_ID: '',
SITE_LEADER_NAME: '',
SITE_LEADER_PHONE: '',
SUPERVISOR_OF_HOT_WORK_UNIT: '',
HOT_WORK_TIME: '',
WORK_LONGITUDE: '',
WORK_LATITUDE: '',
HOT_WORK_UNIT_LEADER_ID: '',
HOT_WORK_UNIT_LEADER_NAME: '',
UNIT_LEADER_ID: '',
UNIT_LEADER_NAME: '',
PROJECT_UNIT_LEADER_ID: '',
PROJECT_UNIT_LEADER_NAME: '',
HOT_WORK_PERMIT_ISSUING_UNIT: '',
HOT_WORK_OPERATOR_NAME: [],
OPINION: '',
},
measureList: [],
imgList: [],
modalShow: false,
submitType: '',
// 其他安全措施
oldOtherMeasure: [],
otherMeasure: [],
}
},
onLoad(event) {
this.form.HOTWORKAPPLICATION_ID = event.id
this.getData();
loginSession();
this.getMeasureList();
},
methods: {
getData() {
var _this = this;
uni.showLoading({
title: '请稍候'
})
uni.request({
url: basePath + '/app/hotworkapplication/goEdit',
method: 'POST',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
HOTWORKAPPLICATION_ID: _this.form.HOTWORKAPPLICATION_ID,
},
success: (res) => {
console.info(res.data)
if ("success" == res.data.result) {
this.form = res.data.pd;
this.oldOtherMeasure = res.data.safetymethodrecordList
let HOT_WORK_OPERATOR_NAME = res.data.pd.HOT_WORK_OPERATOR_NAME
this.form.HOT_WORK_OPERATOR_NAME = HOT_WORK_OPERATOR_NAME.substring(0, HOT_WORK_OPERATOR_NAME.length - 1).split(',');
uni.hideLoading();
} else if ("exception" == res.data.result) {
uni.showToast({
title: '错误',
duration: 2000
});
}
}
});
},
goSubmit() {
var _this = this;
if (this.submitType === 2) {
for (let i = 0; i < this.measureList.length; i++) {
if (!this.measureList[i].radio) {
this.modalShow = false;
uni.showToast({
icon: 'none',
title: '第' + (i + 1) + '项未勾选',
duration: 1500
});
return;
}
}
if (this.imgList.length === 0) {
uni.showToast({
icon: 'none',
title: '请签字',
duration: 1500
});
return;
}
for (let i = 0; i < this.measureList.length; i++) {
if (this.measureList[i].radio == '0') {
uni.showToast({
icon: 'none',
title: '存在不符合条件的安全措施,请打回',
duration: 1500
});
return;
}
}
uni.showLoading({
title: '请稍候'
})
uni.uploadFile({
url: basePath + "/app/hotworkapplication/editOpinion",
filePath: _this.imgList[0].filePath,
name: 'FFILE',
formData: {
...this.form,
measureList: JSON.stringify(_this.measureList),
TYPE: this.submitType,
loginUserId: loginUserId,
CORPINFO_ID: corpinfoId,
STATE: '1',
loginDeptId: loginUser.DEPARTMENT_ID,
loginUserName: loginUser.NAME,
OTHERMEASURE: _this.otherMeasure.join(","),
},
success: (res) => {
uni.hideLoading();
var resJson = JSON.parse(res.data)
if(resJson.result =='success'){
uni.showToast({
icon: 'none',
title: '保存成功',
duration: 2000
});
_this.goback()
}else{
uni.showToast({
icon: 'none',
title: resJson.msg,
duration: 1500,
});
setTimeout(function () {
_this.goback()
}, 1500);
}
},
fail: (err) => {
uni.hideLoading();
uni.showModal({
content: err.errMsg,
showCancel: false
});
}
})
}
if (this.submitType === 1) {
if (!this.form.OPINION) {
this.modalShow = false;
uni.showToast({
icon: 'none',
title: '请填写打回意见',
duration: 1500
});
return;
}
uni.showLoading({
title: '请稍候'
})
uni.request({
url: basePath + "/app/hotworkapplication/editOpinion",
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
...this.form,
TYPE: this.submitType,
loginUserId: loginUserId,
CORPINFO_ID: corpinfoId,
STATE: '1',
loginUserName: loginUser.NAME,
},
success: (res) => {
var resJson = res.data
if(resJson.result =='success'){
uni.showToast({
icon: 'none',
title: '保存成功',
duration: 2000
});
_this.goback()
}else{
uni.showToast({
icon: 'none',
title: resJson.msg,
duration: 1500
});
_this.goback()
}
},
fail: (err) => {
uni.hideLoading();
uni.showModal({
content: err.errMsg,
showCancel: false
});
}
})
}
},
getMeasureList() {
uni.request({
url: basePath + '/app/hotworkapplication/listAllMeasures',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {},
success: (res) => {
let varList = res.data.varList
for (let i = 0; i < varList.length; i++) {
varList[i].radio = ''
}
this.measureList = varList
}
})
},
changeRadioGroup(e, index) {
this.$set(this.measureList[index], 'radio', e.detail.value)
},
confirmType(submitType) {
this.imgList = [];
this.form.OPINION = ''
if (submitType === 1) {
for (let i = 0; i < this.measureList.length; i++) {
if (this.measureList[i].radio == '0') {
this.form.OPINION = this.form.OPINION + this.measureList[i].PROTECTIVE_MEASURES + '(不符合);'
}
}
}
this.submitType = submitType;
this.modalShow = true
},
subCanvas(e) {
this.imgList.push(e);
this.modalShow = false;
this.$nextTick(() => {
this.$noMultipleClicks(this.goSubmit);
});
},
goToGasDelay(id) {
uni.navigateTo({
url: '/pages/application/eight-assignments/hotwork/gasAnalysis/delay?id=' + id
});
},
goback() {
uni.navigateBack({
delta: 1
});
uni.hideLoading();
},
// 其他安全措施
//新增其他安全措施
addOther: function () {
var _this = this;
let o = '';
_this.otherMeasure.push(o);
},
//删除其他安全措施
// removeOldMeasure (i) {
// var _this = this;
// uni.showModal({
// title: '提示',
// cancelText: '确认',
// confirmText: '取消',
// content: '确定删除其他安全措施吗?',
// success: function (res) {
// if (res.cancel) {
// _this.oldOtherMeasure.splice(i, 1)
// }
// }
// });
// },
//删除其他安全措施
removeMeasure(i) {
var _this = this;
uni.showModal({
title: '提示',
cancelText: '确认',
confirmText: '取消',
content: '确定删除其他安全措施吗?',
success: function (res) {
if (res.cancel) {
_this.otherMeasure.splice(i, 1)
}
}
});
},
}
}
</script>
<style lang="scss" scoped>
.handCenter {
margin: 0 40 upx;
.textarea {
padding: 40 upx 0;
}
}
</style>