313 lines
10 KiB
Vue
313 lines
10 KiB
Vue
<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" v-if="GAS_NAME1">
|
||
<view class="title">{{ GAS_NAME1 }}:</view>
|
||
<input name="input" ref="DATA1" v-model="pd.DATA1" placeholder="请输入"></input>
|
||
</view>
|
||
<view class="cu-form-group" v-if="GAS_NAME2">
|
||
<view class="title">{{ GAS_NAME2 }}:</view>
|
||
<input name="input" ref="DATA1" v-model="pd.DATA2" placeholder="请输入"></input>
|
||
</view>
|
||
<view class="cu-form-group" v-if="GAS_NAME3">
|
||
<view class="title">{{ GAS_NAME3 }}:</view>
|
||
<input name="input" ref="DATA1" v-model="pd.DATA3" placeholder="请输入"></input>
|
||
</view>
|
||
<view class="cu-form-group" v-if="GAS_NAME4">
|
||
<view class="title">{{ GAS_NAME4 }}:</view>
|
||
<input name="input" ref="DATA1" v-model="pd.DATA4" placeholder="请输入"></input>
|
||
</view>
|
||
|
||
<view class="cu-form-group ">
|
||
<view class="title">取样分析时间</view>
|
||
<ruiDatePicker
|
||
fields="minute"
|
||
:value="pd.ANALYZE_TIME?pd.ANALYZE_TIME:''"
|
||
:end="currentTime"
|
||
@change="changeStartDate"
|
||
></ruiDatePicker>
|
||
</view>
|
||
|
||
<view class="cu-form-group">
|
||
<view class="title">分析部位:</view>
|
||
<input name="input" ref="ANALYZE_PART" v-model="pd.ANALYZE_PART" placeholder="请输入分析部位"></input>
|
||
</view>
|
||
|
||
<view class="cu-form-group">
|
||
<view class="title">氧气含量:</view>
|
||
<input name="input" ref="OXYGEN_CONTENT" v-model="pd.OXYGEN_CONTENT" placeholder="请输入氧气含量"></input>
|
||
</view>
|
||
<view class="cu-form-group">
|
||
<view class="title">分析地点:</view>
|
||
<input name="input" ref="ANALYZE_PLACE" v-model="pd.ANALYZE_PLACE" placeholder="请输入分析地点"></input>
|
||
</view>
|
||
|
||
<view class="cu-form-group">
|
||
<view>
|
||
<text class="title">分析人:</text>
|
||
<text>{{ pd.ANALYZE_USER }}</text>
|
||
</view>
|
||
</view>
|
||
<view class="cu-form-group">
|
||
<view class="task-remake">友情提示:1.在生产、使用、储存氧气的设备上进行动火作
|
||
业,氧含量不得超过21%。在停用的煤气设备和管道上进行动火作
|
||
业,必须用CO 和 O.检测仪检测合格或爆发试验合格。在经氮气或
|
||
蒸汽置换的煤气管道上动火时,0.含量应低于1%。2、煤气设备和
|
||
管道内 CO 高于24ppm 或O,低于19.5%时,作业人员严禁入内。</view>
|
||
</view>
|
||
<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 wui-sign-box1" 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 class="cu-tag bg-red" @tap.stop="DelImg(index)">
|
||
<text class='cuIcon-close'></text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="cu-modal" :class="modalName=='Modal'?'show':''">
|
||
<writing-board :signShow="modalName =='Modal'" @confirm="subCanvas" @cancel="hideModal"/>
|
||
</view>
|
||
</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(-1))">作废</button>
|
||
<button class="cu-btn bg-green margin-tb-sm lg" @click="$noMultipleClicks(goSubmit(1))">保存</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/horizontal-writing-board/writing-board.vue"
|
||
import ruiDatePicker from '@/components/rattenking-dtpicker/rattenking-dtpicker.vue';
|
||
|
||
export default {
|
||
components: {
|
||
tkiTree, ruiDatePicker, writingBoard
|
||
},
|
||
data() {
|
||
return {
|
||
noClick: true,
|
||
imgList: [],
|
||
buttonloading: false,
|
||
modalName: null,
|
||
pd: {},// 数据
|
||
rules: [
|
||
{name: 'ANALYZE_TIME', message: '请输入取样分析时间'},
|
||
{name: 'ANALYZE_PART', message: '请输入分析部位'},
|
||
{name: 'OXYGEN_CONTENT', message: '请输入氧气含量'},
|
||
{name: 'ANALYZE_PLACE', message: '请输入分析地点'},
|
||
],
|
||
GAS_NAME1: '',
|
||
GAS_NAME2: '',
|
||
GAS_NAME3: '',
|
||
GAS_NAME4: '',
|
||
currentTime: formatDate(new Date(), 'yyyy-MM-dd hh:mm')
|
||
}
|
||
},
|
||
onLoad(event) {
|
||
this.pd.CONFINEDSPACE_ID = event.CONFINEDSPACE_ID;
|
||
this.GAS_NAME1 = event.GAS_NAME1;
|
||
this.GAS_NAME2 = event.GAS_NAME2;
|
||
this.GAS_NAME3 = event.GAS_NAME3;
|
||
this.GAS_NAME4 = event.GAS_NAME4;
|
||
this.pd.ANALYZE_USER = loginUser.NAME;
|
||
loginSession();
|
||
},
|
||
methods: {
|
||
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)
|
||
})
|
||
},
|
||
/*
|
||
*手写板
|
||
*/
|
||
showModal(e) {
|
||
this.modalName = e.currentTarget.dataset.target
|
||
},
|
||
hideModal(e) {
|
||
this.modalName = null
|
||
},
|
||
DelImg(index) {
|
||
this.imgList.splice(index, 1)
|
||
},
|
||
//完成
|
||
subCanvas(e) {
|
||
let t = {
|
||
id: "",
|
||
filePath: e.tempFile,
|
||
SIGNER_TIME: ''
|
||
}
|
||
t.SIGNER_TIME = formatDate(new Date(), 'yyyy-MM-dd hh:mm')
|
||
this.imgList.push(t);
|
||
this.hideModal()
|
||
},
|
||
ViewImage(e) {
|
||
let files = [];
|
||
files.push(e.currentTarget.dataset.url)
|
||
uni.previewImage({
|
||
urls: files,
|
||
current: e.currentTarget.dataset.url
|
||
});
|
||
},
|
||
goSubmit(APPLY_STATUS) {
|
||
this.buttonloading = true
|
||
var _this = this;
|
||
let required = true
|
||
if (_this.imgList.length <= 0) {
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: '请签字',
|
||
duration: 1500
|
||
});
|
||
return;
|
||
}
|
||
if (APPLY_STATUS == 1) {
|
||
this.rules.map(({name, message}) => {
|
||
if (!this.pd[name]) {
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: message,
|
||
duration: 1500
|
||
});
|
||
required = false
|
||
}
|
||
})
|
||
}
|
||
if (!required) {
|
||
return
|
||
}
|
||
uni.showModal({
|
||
title: '请确认' + (APPLY_STATUS == 1 ? "通过" : "作废") + '本作业票?',
|
||
placeholderText: '请输入作废原因',
|
||
cancelColor: "#000000",
|
||
cancelText: '取消',
|
||
editable: APPLY_STATUS != 1,
|
||
confirmText: '确定',
|
||
success: res => {
|
||
if (res.confirm) {
|
||
if (APPLY_STATUS != 1 && !res.content) {
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: '请填写作废原因',
|
||
duration: 1500
|
||
});
|
||
return;
|
||
}
|
||
if (this.GAS_NAME1 && !this.pd.DATA1) this.pd.DATA1 = 0
|
||
if (this.GAS_NAME2 && !this.pd.DATA2) this.pd.DATA2 = 0
|
||
if (this.GAS_NAME3 && !this.pd.DATA3) this.pd.DATA3 = 0
|
||
if (this.GAS_NAME4 && !this.pd.DATA4) this.pd.DATA4 = 0
|
||
uni.showLoading({
|
||
title: '请稍候'
|
||
})
|
||
var files = [];
|
||
var signtime = [];
|
||
const formData = {}
|
||
Object.keys(this.pd).map(key => {
|
||
formData[key] = this.pd[key]
|
||
})
|
||
this.uploadImgFaults(files, signtime)
|
||
formData.STEP_REASON = res.content ? res.content : ''
|
||
formData.SIGNTIME = signtime
|
||
formData.CORPINFO_ID = loginUser.CORPINFO_ID
|
||
formData.USER_ID = loginUser.USER_ID
|
||
formData.APPLY_STATUS = APPLY_STATUS
|
||
uni.uploadFile({
|
||
url: basePath + "app/confinedspace/gas/save",
|
||
files: files,
|
||
formData: formData,
|
||
success: (res) => {
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: '保存成功',
|
||
duration: 2000
|
||
});
|
||
this.buttonloading = false
|
||
if (APPLY_STATUS === 1) {
|
||
uni.navigateBack({delta: 1});
|
||
} else {
|
||
uni.navigateBack({delta: 3});
|
||
}
|
||
// _this.goback()
|
||
},
|
||
fail: (err) => {
|
||
uni.hideLoading();
|
||
uni.showModal({
|
||
content: err.errMsg,
|
||
showCancel: false
|
||
});
|
||
}
|
||
})
|
||
}
|
||
}
|
||
})
|
||
|
||
},
|
||
|
||
changeStartDate(e) {
|
||
this.pd.ANALYZE_TIME = e
|
||
this.$forceUpdate();//强制刷新
|
||
},
|
||
|
||
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>
|
||
.wui-sign-box1 {
|
||
margin-top: 20upx;
|
||
display: block;
|
||
}
|
||
|
||
.sign-img {
|
||
position: relative;
|
||
border-bottom: 1px dashed #eee;
|
||
padding-top: 20upx;
|
||
}
|
||
|
||
.cu-tag {
|
||
position: absolute;
|
||
right: 20upx;
|
||
top: 20upx;
|
||
}
|
||
</style>
|