动火安全措施确认

pull/5/head
fangjiakai 2024-01-24 14:03:35 +08:00
parent 9605a827e1
commit 589716c05d
7 changed files with 736 additions and 124 deletions

View File

@ -379,6 +379,10 @@
"path": "pages/application/hotwork/hotwork-measures/hotwork-measures-detail",
"style": {}
},
{
"path": "pages/application/hotwork/hotwork-measures-confirm/hotwork-measures-confirm-detail",
"style": {}
},
{
"path": "pages/application/hotwork/hotwork-guardian/hotwork-guardian-detail",
"style": {}

View File

@ -0,0 +1,9 @@
var measures;
export const setMeasures = (e) => {
measures = e;
};
export const getMeasures = () => {
return measures
};

View File

@ -6,23 +6,53 @@
</cu-custom>
<view class="form">
<view class="wui-form-list">
<uni-table border stripe >
<!-- 表头行 -->
<uni-tr>
<uni-th align="center" style="font-weight: bold;">主要安全措施</uni-th>
<uni-th align="center">
<view class="title">操作</view>
</uni-th>
</uni-tr>
<uni-tr >
<uni-td>
<view style="margin-bottom: 20upx;">
{{measures}}
</view>
</uni-td>
<uni-td align="center">
<radio-group class="wui-radio-group wui-radio-col">
<view class="group" style="margin-bottom: 10px">
<radio class='radio' value="-1" :checked="STATUS=='-1'" @click="changeRadio('-1')">
<text class="wui-pl10">不涉及</text></radio>
</view>
<view class="group" style="margin-bottom: 10px">
<radio class='radio' value="1" :checked="STATUS=='1'" @click="changeRadio('1')">
<text class="wui-pl10">&nbsp;&nbsp;&nbsp;&nbsp;</text></radio>
</view>
</radio-group>
</uni-td>
</uni-tr>
</uni-table>
<view class="cu-bar bg-white margin-top">
<view class="action">
上传图片
</view>
<view class="action">
{{ imgList.length }}/4
{{ imgList.length }}/2
</view>
</view>
<view class="cu-form-group">
<view class="grid col-4 grid-square flex-sub">
<view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="viewImage(index,'imgList')">
<image :src="imgList[index].filePath" mode="aspectFill"></image>
<image :src="baseImgPath + item.filePath" mode="aspectFill"></image>
<view class="cu-tag bg-red" @tap.stop="delImg" data-type="2" :data-index="index">
<text class='cuIcon-close'></text>
</view>
</view>
<view class="solids" @tap="chooseImage()" v-if="imgList.length<4">
<view class="solids" @tap="chooseImage()" v-if="imgList.length<2">
<text class='cuIcon-cameraadd'></text>
</view>
</view>
@ -37,7 +67,8 @@
</view>
<view class="wui-sign-cotent">
<view class="sign-img" v-for="(item,index) in signImgList" :key="index" @tap="viewImage(index,'signImgList')">
<image :src="signImgList[index].filePath" mode="aspectFit"></image>
<image v-if="item.filePath.indexOf('uploadFiles') > -1" :src="baseImgPath + item.filePath" mode="aspectFit"></image>
<image v-else :src="item.filePath" mode="aspectFit"></image>
</view>
</view>
</view>
@ -54,6 +85,10 @@
</template>
<script>
import {
basePath,baseImgPath,loginUser
} from '@/common/tool.js';
import {setMeasures,getMeasures} from './index.js';
import {formatDate} from "@/common/tool";
import writingBoard from "@/components/writing-board/writing-board.vue"
@ -63,6 +98,9 @@ export default {
},
data() {
return {
baseImgPath:baseImgPath,
measures:getMeasures(),
STATUS:1,
imgList: [],
currentIndex: 0,
modalName: null,
@ -72,19 +110,26 @@ export default {
}
},
onLoad(event) {
this.imgList = event.imgList || [];
this.signImgList = event.signImgList || [];
this.imgList = JSON.parse(event.imgList) || [];
this.signImgList = JSON.parse(event.signImgList) || [];
console.log(this.signImgList)
console.log(JSON.parse(event.signImgList) )
this.currentIndex = event.index || 0;
this.STATUS = event.STATUS || 1;
},
methods: {
changeRadio(value){
this.STATUS=value
},
viewImage(index,list) {
let files = this[list].map(item => item.filePath);
uni.previewImage({
urls: files,
urls: baseImgPath + files,
current: index
});
},
delImg(e) {
var _this = this;
uni.showModal({
title: '秦安双控',
content: '确定要删除这张图片吗?',
@ -93,24 +138,60 @@ export default {
confirmText: '确定',
success: res => {
if (res.confirm) {
uni.request({
url: basePath+'/app/eightwork/deleteFile',
method: 'POST',
dataType: 'json',
header: {
'Content-type':'application/x-www-form-urlencoded'
},
data: {
FILE_PATH:_this.imgList[e.currentTarget.dataset.index].filePath
},
success: (res) => {
uni.showToast({
icon: 'none',
title: '删除成功',
duration: 1500
});
this.imgList.splice(e.currentTarget.dataset.index, 1)
},
fail: (err) => {
uni.showModal({
content: "删除失败",
showCancel: false
});
}
})
}
}
})
},
chooseImage() {
var ss = 4 - this.imgList.length;
uni.chooseImage({
count: ss, //9
count: 1, //9
sizeType: ['original', 'compressed'], //
sourceType: ['camera', 'album'], //
success: (res) => {
for (let i = 0; i < res.tempFilePaths.length; i++) {
uni.uploadFile({
url: basePath+'/app/eightwork/saveFile',
filePath: res.tempFilePaths[0],
name: 'file',
formData: {
CORPINFO_ID:loginUser.CORPINFO_ID,
},
success: ({data}) => {
let img = {};
img.id = '';
img.filePath = res.tempFilePaths[i];
img.filePath = JSON.parse(data).FILE_PATH;
this.imgList.push(img)
},
fail: (err) => {
uni.showModal({
content: "图片上传失败",
showCancel: false
});
}
})
}
});
},
@ -127,18 +208,11 @@ export default {
SIGNER_TIME: formatDate(new Date(), 'yyyy-MM-dd hh:mm'),
filePath: e.filePath
});
console.log(this.signImgList)
this.hideModal()
},
goSubmit() {
if(this.buttonloading) return;
if(this.imgList.length === 0) {
uni.showToast({
title: '请上传图片',
icon: 'none'
});
return;
}
console.log(this.signImgList)
if(this.signImgList.length === 0) {
uni.showToast({
title: '请签字',
@ -146,21 +220,36 @@ export default {
});
return;
}
uni.uploadFile({
url: basePath+'/app/eightwork/saveFile',
filePath: this.signImgList[0].filePath,
name: 'file',
formData: {
CORPINFO_ID:loginUser.CORPINFO_ID,
},
success: ({data}) => {
this.signImgList[0].filePath = JSON.parse(data).FILE_PATH;
this.buttonloading = true;
setMeasures("")
uni.$emit('dangerous_options_submit', {
imgList: this.imgList,
signImgList: this.signImgList,
index: this.currentIndex
index: this.currentIndex,
STATUS: this.STATUS
});
this.goback()
},
fail: (err) => {
uni.showModal({
content: "图片上传失败",
showCancel: false
});
//
// mounted() {
// uni.$on('dangerous_options_submit', (data) => {})
// },
//
// beforeDestroy() {
// uni.$off('dangerous_options_submit');
// },
}
})
},
goback(){
uni.navigateBack({delta: 1});
},
},
}
</script>

View File

@ -32,13 +32,22 @@
</view>
</navigator>
<navigator class="apps-item" hover-class="none" url="/pages/application/hotwork/hotwork-list/index?flow=设置安全措施确认人">
<view class="imgs action">
<image src="../../../static/icon-apps/icon-yh-1.png" mode=""></image>
<view v-if="count.MEASURES_SET" class="cu-tag badge">{{count.MEASURES_SET}}</view>
</view>
<view class="text-semi" style="text-align: center;">
<view>设置安全</view>
<view>措施确认人</view>
</view>
</navigator>
<navigator class="apps-item" hover-class="none" url="/pages/application/hotwork/hotwork-list/index?flow=安全措施确认">
<view class="imgs action">
<image src="../../../static/icon-apps/icon-yh-1.png" mode=""></image>
<view v-if="count.MEASURES_CONFIRM" class="cu-tag badge">{{count.MEASURES_CONFIRM}}</view>
</view>
<view class="text-semi" style="text-align: center;">
<view>安全措施</view>
<view>确认人意见</view>
<view>安全措施确认</view>
</view>
</navigator>
<navigator class="apps-item" hover-class="none" url="/pages/application/hotwork/hotwork-list/index?flow=监护人签字">

View File

@ -167,6 +167,10 @@
uni.navigateTo({
url: '/pages/application/hotwork/hotwork-measures/hotwork-measures-detail?HOTWORK_ID='+e
});
}else if(this.flow === '安全措施确认'){
uni.navigateTo({
url: '/pages/application/hotwork/hotwork-measures-confirm/hotwork-measures-confirm-detail?HOTWORK_ID='+e
});
}else if(this.flow === '监护人签字'){
uni.navigateTo({
url: '/pages/application/hotwork/hotwork-guardian/hotwork-guardian-detail?HOTWORK_ID='+e

View File

@ -0,0 +1,491 @@
<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 group-picker" >
<view class="title">申请单位</view>
{{pd.APPLY_DEPARTMENT_NAME}}
</view>
<view class="cu-form-group group-picker" >
<view class="title">申请人</view>
{{pd.APPLY_USER_NAME}}
</view>
<view class="cu-form-group bb-default">
<view class="title">编号</view>
{{pd.CHECK_NO}}
</view>
<view class="cu-form-group bb-default">
<view class="title">作业内容</view>
{{pd.WORK_CONTENT}}
</view>
<view class="cu-form-group bb-default">
<view class="title">动火地点及动火部位</view>
{{pd.WORK_PLACE}}
</view>
<view class="cu-form-group bb-default">
<view class="title">动火作业级别</view>
{{pd.WORK_LEVEL}}
</view>
<view class="cu-form-group bb-default">
<view class="title">动火方式</view>
{{pd.WORK_FUNCTION}}
</view>
<view class="cu-form-group bb-default">
<view class="title">动火人及证书编号</view>
{{pd.WORK_USER}}
</view>
<view class="cu-form-group bb-default">
<view class="title">关联的其他特殊作业及安全作业票编号</view>
{{pd.SPECIAL_WORK}}
</view>
<view class="cu-form-group bb-default">
<view class="title">风险辨识结果</view>
{{pd.RISK_IDENTIFICATION}}
</view>
<view class="cu-form-group bb-default">
<text class="title">分析人</text>
<text>{{pd.ANALYZE_USER_NAME}}</text>
<button class="cu-btn bg-green sm" @click="$noMultipleClicks(goToDetail,pd.HOTWORK_ID)"></button>
</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">
<view class="title">操作</view>
</uni-th>
</uni-tr>
<template v-for="(item,index) in measuresList">
<uni-tr>
<uni-td>
<view style="margin-bottom: 20upx;">
{{item.PROTECTIVE_MEASURES}}
</view>
<view class="cu-form-group" v-if="item.QUESTION1">
<view class="title">{{item.QUESTION1}}</view>
<input name="input" v-model="item.ANSWER1" type="number" 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" type="number" 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" type="number" 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" type="number" placeholder="请输入"></input>
</view>
</uni-td>
<uni-td align="center">
<view class="title" @click="$noMultipleClicks(goToSign,index)"></view>
</uni-td>
</uni-tr>
</template>
</uni-table>
</view>
<view class="wui-sign" >
<view class="title"></view>
<button class="cu-btn bg-green shadow" @tap="showModal" data-target="Modal">手写签字</button>
</view>
<view class="wui-sign-box" v-show="imgList && imgList.length > 0">
<view class="sign-title">
签字照片
</view>
<view class="wui-sign-cotent">
<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>
<view class="cu-modal" :class="modalName=='Modal'?'show':''">
<writing-board @confirm="subCanvas" @cancel="hideModal"></writing-board>
</view>
</view>
</view>
<view class="cu-bar btn-group" style="margin-top: 30upx;">
<button class="cu-btn bg-red margin-tb-sm lg" @click="$noMultipleClicks(goSubmit,'-2')"> </button>
<button :loading="buttonloading" class="cu-btn bg-green margin-tb-sm lg" @click="$noMultipleClicks(goSubmit,'2')"> </button>
</view>
<view class="padding flex flex-direction">
</view>
</scroll-view>
</view>
</template>
<script>
import {
basePath,corpinfoId,deptId,loginUser,formatDate,loginSession,baseImgPath
} from '@/common/tool.js';
import tkiTree from "@/components/select-tree/select-tree.vue"
import writingBoard from "@/components/writing-board/writing-board.vue"
import gcoord from '@/common/gcoord.js'
import ruiDatePicker from '@/components/rattenking-dtpicker/rattenking-dtpicker.vue';
import { setMeasures } from '@/pages/application/dangerous_options/index.js';
export default {
components: {
tkiTree,ruiDatePicker,writingBoard
},
data() {
return {
baseImgPath:baseImgPath,
buttonloading: false,
noClick:true,
treeNode:[],//
pd:{},//
measuresList:[],
modalName:null,
imgList:[],
}
},
onLoad(event){
this.pd.HOTWORK_ID = event.HOTWORK_ID;
this.getData();
//
this.getDept();
this.getMeasures();
loginSession();
},
//
mounted() {
uni.$on('dangerous_options_submit', (data) => {
console.log(data)
this.measuresList[data.index].SIGN_PATH = data.signImgList[0].filePath
this.measuresList[data.index].SIGN_TIME = data.signImgList[0].SIGNER_TIME
this.measuresList[data.index].IMG_PATH = data.imgList.map(item => {
return item.filePath
}).join(",")
this.measuresList[data.index].STATUS = data.STATUS
})
},
//
beforeDestroy() {
uni.$off('dangerous_options_submit');
},
methods: {
//
goToDetail(e) {
uni.navigateTo({
url: '/pages/application/hotwork/hotwork-gas/gas-list?HOTWORK_ID='+e
});
},
goToSign(index) {
const measures = this.measuresList[index]
const signImgList = []
if (measures.SIGN_PATH) {
signImgList.push({"filePath":measures.SIGN_PATH,"SIGNER_TIME":measures.SIGN_TIME})
}
const imgList = []
if (measures.IMG_PATH) {
measures.IMG_PATH.split(",").forEach(item => {
imgList.push({"filePath":item})
})
}
setMeasures(measures.PROTECTIVE_MEASURES)
uni.navigateTo({
url: '/pages/application/dangerous_options/index?index='+index +
'&STATUS='+(measures.STATUS || 1) + '&signImgList='+JSON.stringify(signImgList) + '&imgList='+JSON.stringify(imgList)
});
},
getData() {
var _this = this;
uni.showLoading({
title: '请稍候'
})
uni.request({
url: basePath + '/app/hotwork/findById',
method: 'POST',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
HOTWORK_ID: _this.pd.HOTWORK_ID,
CORPINFO_ID:loginUser.CORPINFO_ID,
USER_ID:loginUser.USER_ID,
},
success: (res) => {
if ("success" == res.data.result) {
uni.hideLoading();
_this.pd = res.data.pd; //map
} else if ("exception" == data.result) {
uni.showToast({
title: '错误',
duration: 2000
});
}
}
});
},
goSubmit(){
var _this = this;
uni.showLoading({
title: '请稍候'
})
if (_this.imgList.length <= 0) {
uni.showToast({
icon: 'none',
title: '请签字',
duration: 1500
});
return;
}
for (let i = 0; i < this.measuresList.length; i++) {
const measures = this.measuresList[i]
if(measures.QUESTION1 && !measures.ANSWER1){
uni.showToast({
icon: 'none',
title: '第'+(i+1)+'项未填写第一项',
duration: 1500
});
return;
}
if(measures.QUESTION2 && !measures.ANSWER2){
uni.showToast({
icon: 'none',
title: '第'+(i+1)+'项未填写第二项',
duration: 1500
});
return;
}
if(measures.QUESTION3 && !measures.ANSWER3){
uni.showToast({
icon: 'none',
title: '第'+(i+1)+'项未填写第三项',
duration: 1500
});
return;
}
if(measures.QUESTION4 && !measures.ANSWER4){
uni.showToast({
icon: 'none',
title: '第'+(i+1)+'项未填写第四项',
duration: 1500
});
return;
}
if(!measures.SIGN_PATH){
uni.showToast({
icon: 'none',
title: '第'+(i+1)+'项未签字',
duration: 1500
});
return;
}
}
const formData={}
var files = [];
var signtime = [];
this.uploadImgFaults(files,signtime)
formData.HOTWORK_ID = _this.pd.HOTWORK_ID
formData.SIGNTIME = signtime.join(",")
formData.USER_ID = loginUser.USER_ID
formData.MEASURES = JSON.stringify(this.measuresList)
uni.uploadFile({
url: basePath+'app/hotwork/nextStep',
files: 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
});
}
})
},
uploadImgFaults(files,signtime) {
this.imgList.map((item,index) => {
var img = {}
img.name = 'file'+index
img.uri = item.filePath
files.push(img)
signtime.push(item.SIGNER_TIME)
})
},
getMeasures(){
var _this = this;
uni.request({
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
url: basePath + '/app/hotwork/listAllMeasuresForSign?tm=' + new Date().getTime(),
data: {
CORPINFO_ID:loginUser.CORPINFO_ID,
CONFIRM_ID:loginUser.USER_ID,
HOTWORK_ID: _this.pd.HOTWORK_ID,
},
success: function (res) {
_this.measuresList = res.data.measuresForSignList
}
});
},
getDept() {
var _this = this;
uni.request({
url: basePath + '/app/sys/listTree',//
method: 'POST',
dataType: 'json',
header: {
'Content-type':'application/x-www-form-urlencoded'
},
data: {
CORPINFO_ID:loginUser.CORPINFO_ID,
USER_ID:loginUser.USER_ID,
},
success: (res) => {
if("success" == res.data.result){
_this.treeNode=eval(res.data.zTreeNodes);
} else {
uni.showToast({
title: res.data.message,
duration: 2000
});
}
}
});
},
showDeptTree(index) {
this.isUps=true
this.$refs['tkiTree'+index][0]._show();
},
deptTreeConfirm(e,i) {
this.isUps=false;
this.measuresList[i].DEPARTMENT_ID=e[0].id;
this.measuresList[i].DEPARTMENT_NAME=e[0].name;
this.measuresList[i].USER_ID = ''
this.measuresList[i].USER_NAME = ''
this.getUserList(e[0].id,i);
},
deptTreeCancel(e) {
this.isUps=false;
},
pickerUser(e,i) {
this.measuresList[i].userIndex = e.detail.value;
this.measuresList[i].USER_ID=this.measuresList[i].userList[e.detail.value].USER_ID;
this.measuresList[i].USER_NAME=this.measuresList[i].userList[e.detail.value].NAME;
this.$forceUpdate();//
},
isBlankList(i) {
if (this.measuresList[i].userList.length == 0) {
uni.showToast({
icon: 'none',
title: '请先选择确认单位',
duration: 1500
})
}
},
//
getUserList(dept,i){
// post
var _this=this
uni.request({
method: 'POST',
dataType: 'json',
header: {
'Content-type':'application/x-www-form-urlencoded'
},
url: basePath+'/app/sys/listUser',
data: {
DEPARTMENT_ID:dept,
tm:new Date().getTime(),
CORPINFO_ID:loginUser.CORPINFO_ID,
USER_ID:loginUser.USER_ID,
},
success: function(res){
if("success" == res.data.result){
_this.measuresList[i].userList = res.data.userList;
}else{
uni.showToast({
title: res.data.message,
duration: 2000
});
}
}
})
},
/*
*手写板
*/
showModal(e) {
this.modalName = e.currentTarget.dataset.target
},
hideModal(e) {
this.modalName = null
},
//
subCanvas(e) {
e.SIGNER_TIME = formatDate(new Date(), 'yyyy-MM-dd hh:mm')
this.imgList.splice(0,this.imgList.length);
this.imgList.push(e);
this.hideModal()
},
ViewImage(e) {
let files =[];
files.push(e.currentTarget.dataset.url)
uni.previewImage({
urls: files,
current: e.currentTarget.dataset.url
});
},
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>

View File

@ -233,11 +233,17 @@
const formData={}
var files = [];
var signtime = [];
const signers = this.measuresList.map(item => {
return {
BUS_HOTWORK_MEASURES_ID: item.BUS_HOTWORK_MEASURES_ID,
USER_ID: item.USER_ID
}
})
this.uploadImgFaults(files,signtime)
formData.HOTWORK_ID = _this.pd.HOTWORK_ID
formData.SIGNTIME = signtime.join(",")
formData.USER_ID = loginUser.USER_ID
formData.PREPARERS = JSON.stringify(_this.measuresList)
formData.PREPARERS = JSON.stringify(signers)
uni.uploadFile({
url: basePath+'app/hotwork/nextStep',
files: files,
@ -248,7 +254,7 @@
title: '保存成功',
duration: 2000
});
// _this.goback()
_this.goback()
},
fail: (err) => {
uni.hideLoading();
@ -395,9 +401,9 @@
},
//
subCanvas(e) {
e.SIGNER_TIME = formatDate(new Date(), 'yyyy-MM-dd hh:mm')
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()
},
ViewImage(e) {