QA-UniApp-wlaq/pages/application/gas-detection/gas-detection-detail.vue

451 lines
12 KiB
Vue
Raw Permalink Normal View History

2024-11-19 14:17:54 +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="cu-form-textarea">
<view class="cu-form-title text-hui">检查内容</view>
<view class="f24 text-black">
{{pd.CHECK_CONTENT}}
</view>
</view> -->
<view class="de-card-list de-list">
<view class="cu-form-group ">
<view class="title">检测位置</view>
<input name="input" :disabled="msg=='edit'" v-model="pd.LOCATION" placeholder="请输入检测位置"></input>
</view>
<view class="cu-form-group ">
<view class="title">检测时间</view>
<ruiDatePicker v-if="msg!='edit'"
:start="todayDate"
fields="minute"
:value="pd.TESTINGTIME?pd.TESTINGTIME:'请选择'"
@change="changeTestingTime"
></ruiDatePicker>
<view v-else>{{pd.TESTINGTIME}}</view>
<!-- <picker :start="todayDate" mode="date" :disabled="msg=='edit'" :value="pd.TESTINGTIME" @change="changeTestingTime">
<view class="picker">
{{pd.TESTINGTIME?pd.TESTINGTIME:'请选择'}}
</view>
</picker> -->
</view>
</view>
<view class="de-card-list de-list">
<view class="de-title">
<text class="text-semi">检测内容及数值</text>
</view>
<view class="cu-form-group ">
<view class="title">氧气</view>
<input name="input" :disabled="msg=='edit'" type="digit" v-model="pd.OXYGEN" placeholder="单位%"></input>%
</view>
<view class="cu-form-group ">
<view class="title">可燃气体</view>
<input name="input" :disabled="msg=='edit'" type="digit" v-model="pd.COMBUSTIBLEGAS" placeholder="单位%LEL"></input>%LEL
</view>
<view class="cu-form-group sp-text-center">
<view class="title">硫化氢</view>(
<input name="input" :disabled="msg=='edit'" type="digit" v-model="pd.HYDROTHIONSTART" placeholder="">)ppm-(</input>
<input name="input" :disabled="msg=='edit'" type="digit" v-model="pd.HYDROTHIONEND" placeholder="">)mg-m3)</input>
</view>
<view class="cu-form-group sp-text-center">
<view class="title">一氧化碳</view>(
<input name="input" :disabled="msg=='edit'" type="digit" v-model="pd.CARBONICOXIDESTART" placeholder="">)ppm-(</input>
<input name="input" :disabled="msg=='edit'" type="digit" v-model="pd.CARBONICOXIDEEND" placeholder="">)mg-m3)</input>
</view>
<view class="cu-form-group sp-text-center">
<view class="title">其他气体</view>(
<input name="input" :disabled="msg=='edit'" type="digit" v-model="pd.OTHERGASESSTART" placeholder="">)ppm-(</input>
<input name="input" :disabled="msg=='edit'" type="digit" v-model="pd.OTHERGASESEND" placeholder="">)mg-m3)</input>
</view>
<view class="cu-form-group ">
<view class="title text-hui">判定</view>
<radio-group class="selected" @change="radioType" :disabled="msg=='edit'">
<view class="group mr20">
<radio class='radio' :disabled="msg=='edit'" value="1" :checked="pd.DECIDE==1"></radio>
<text>合格</text>
</view>
<view class="group">
<radio class='radio' :disabled="msg=='edit'" value="0" :checked="pd.DECIDE==0"></radio>
<text>不合格</text>
</view>
</radio-group>
</view>
</view>
</view>
<view class="padding flex flex-direction">
<button v-if="msg=='add'" class="cu-btn bg-blue margin-tb-sm lg" @click="$noMultipleClicks(goSubmit)"></button>
</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 gcoord from '@/common/gcoord.js'
import ruiDatePicker from '@/components/rattenking-dtpicker/rattenking-dtpicker.vue';
export default {
components: {
tkiTree,ruiDatePicker
},
data() {
return {
isUps:false,
msg:'add',
riskId:'',
itemId:'',
index:'',
noClick:true,
pd:[],// 数据
todayDate:'',
loginUserId:'',
LIMITSPACEAPPROVE_ID:'',
TYPE:''
}
},
onLoad(event){
this.todayDate = formatDate(new Date(), 'yyyy-MM-dd hh:mm');
this.pd.GASDETECTION_ID = event.GASDETECTION_ID;
this.LIMITSPACEAPPROVE_ID = event.LIMITSPACEAPPROVE_ID;
this.TYPE = event.type;
if(this.pd.GASDETECTION_ID){
this.msg="edit";
this.getData();
}
this.loginUserId = loginUser.USER_ID;
this.getDict();
this.getUserList();
loginSession();
},
methods: {
getData() {
var _this = this;
uni.showLoading({
title: '请稍候'
})
uni.request({
url: basePath + '/app/gasdetection/goEdit',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
GASDETECTION_ID: _this.pd.GASDETECTION_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
});
}
}
});
},
//获取数据字典数据
getDict: function () {
var _this = this;
uni.request({
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
url: basePath + '/dictionaries/getLevels?tm=' + new Date().getTime(),
data: {DICTIONARIES_ID: 'dad23a464729485ba364994942db83cc'},
dataType: 'json',
success: function (res) {
_this.finiteSpaceList = res.data.list;
}
});
uni.request({
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
url: basePath + '/dictionaries/getLevels?tm=' + new Date().getTime(),
data: {DICTIONARIES_ID: 'a178357ce6ce4d6a9ac95def6aca3a14'},
dataType: 'json',
success: function (res) {
_this.riskGradeList = res.data.list;
}
});
},
// 获取用户列表
getUserList(){
var _this = this;
uni.request({
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
url: basePath + '/app/user/listUserByCorp?tm=' + new Date().getTime(),
data: {CORPINFO_ID: corpinfoId},
dataType: 'json',
success: function (res) {
_this.userList = res.data.userList;
}
});
},
finiteSpaceChange(e) {
this.findex = e.detail.value;
this.pd.LIMITSPACETYPE=this.finiteSpaceList[this.findex].BIANMA;
this.pd.LIMITSPACETYPENAME=this.finiteSpaceList[this.findex].NAME;
this.$forceUpdate();//强制刷新
},
riskGradeChange(e) {
this.rindex = e.detail.value;
this.pd.RISKGRADE=this.riskGradeList[this.rindex].BIANMA;
this.pd.RISKGRADENAME=this.riskGradeList[this.rindex].NAME;
this.$forceUpdate();//强制刷新
},
informantChange(e){
this.uindex = e.detail.value;
this.pd.INFORMANT=this.userList[this.uindex].USER_ID;
this.pd.INFORMANTNAME=this.userList[this.uindex].USERNAME;
this.$forceUpdate();//强制刷新
},
principalChange(e){
this.pindex = e.detail.value;
this.pd.PRINCIPAL=this.userList[this.pindex].USER_ID;
this.pd.PRINCIPALNAME=this.userList[this.pindex].USERNAME;
this.$forceUpdate();//强制刷新
},
isPosInt(){
if(!/^[1-9]\d*$/.test(this.pd.MAXPERSON)){
uni.showToast({
icon: 'none',
title: '请输入正整数',
duration: 1500
});
}
},
changeTestingTime(e) {
this.pd.TESTINGTIME = e
this.$forceUpdate();//强制刷新
},
goSubmit() {
var _this = this;
uni.showLoading({
title: '请稍候'
})
if (!_this.pd.LOCATION) {
uni.showToast({
icon: 'none',
title: '请填检测位置',
duration: 1500
});
return;
}
if (!_this.pd.TESTINGTIME || _this.pd.TESTINGTIME == '请选择') {
uni.showToast({
icon: 'none',
title: '请填检测时间',
duration: 1500
});
return;
}
if (!_this.pd.OXYGEN) {
uni.showToast({
icon: 'none',
title: '请选择氧气',
duration: 1500
});
return;
}
if (!_this.pd.COMBUSTIBLEGAS) {
uni.showToast({
icon: 'none',
title: '请填可燃气体',
duration: 1500
});
return;
}
if (!_this.pd.HYDROTHIONSTART) {
uni.showToast({
icon: 'none',
title: '请填硫化氢',
duration: 1500
});
return;
}
if (!_this.pd.HYDROTHIONEND) {
uni.showToast({
icon: 'none',
title: '请填硫化氢',
duration: 1500
});
return;
}
if (!_this.pd.CARBONICOXIDESTART) {
uni.showToast({
icon: 'none',
title: '请填一氧化碳',
duration: 1500
});
return;
}
if (!_this.pd.CARBONICOXIDEEND) {
uni.showToast({
icon: 'none',
title: '请填一氧化碳',
duration: 1500
});
return;
}
if (!_this.pd.OTHERGASESSTART) {
uni.showToast({
icon: 'none',
title: '请填其他气体',
duration: 1500
});
return;
}
if (!_this.pd.OTHERGASESEND) {
uni.showToast({
icon: 'none',
title: '请填其他气体',
duration: 1500
});
return;
}
if (!_this.pd.DECIDE) {
uni.showToast({
icon: 'none',
title: '请选择判定结果',
duration: 1500
});
return;
}
uni.request({
url: basePath+'/app/gasdetection/'+_this.msg,
method: 'POST',
dataType: 'json',
header: {
'Content-type':'application/x-www-form-urlencoded'
},
data: {
GASDETECTION_ID:this.pd.GASDETECTION_ID,
LOCATION:this.pd.LOCATION,
TESTINGTIME:this.pd.TESTINGTIME,
OXYGEN:this.pd.OXYGEN,
COMBUSTIBLEGAS:this.pd.COMBUSTIBLEGAS,
HYDROTHIONSTART:this.pd.HYDROTHIONSTART,
CARBONICOXIDESTART:this.pd.CARBONICOXIDESTART,
OTHERGASESSTART:this.pd.OTHERGASESSTART,
HYDROTHIONEND:this.pd.HYDROTHIONEND,
CARBONICOXIDEEND:this.pd.CARBONICOXIDEEND,
OTHERGASESEND:this.pd.OTHERGASESEND,
DECIDE:this.pd.DECIDE,
TYPE:this.TYPE,
LIMITSPACEAPPROVE_ID:this.LIMITSPACEAPPROVE_ID,
CORPINFO_ID:corpinfoId,
USER:loginUser.USER_ID,
},
success: (res) => {
uni.hideLoading();
if ("success" == res.data.result) {
uni.showToast({
icon: 'none',
title: '提交成功',
duration: 1500
});
setTimeout(function(){
var pages = getCurrentPages(); // 获取当前页面栈
var prePage = pages[pages.length - 2]; // 上二级页面
prePage.$vm.initflag = true; // A 页面 init方法 为true
uni.navigateBack({delta: 1});
uni.hideLoading();
},1500);
}else{
uni.showToast({
icon:'none',
title: '系统错误',
duration: 2000
});
}
}
});
},
radioType(e){
this.pd.DECIDE = e.detail.value
},
goToEdit(){
this.forbidEdit = false;
}
}
}
</script>
<style>
.prevent {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
overflow: hidden;
}
.cu-form-title{
padding: 20upx 0;
}
.cu-form-textarea{
background-color: #ffffff;
padding: 1upx 30upx 20upx;
min-height: 100upx;
}
.cu-form-textarea textarea {
height: 4.6em;
width: 100%;
line-height: 1.2em;
flex: 1;
font-size: 28upx;
padding: 0;
}
.selected{
display: flex;
align-items: center;
height: 100upx;
}
.selected .radio{
transform:scale(0.8);
margin-right: 10upx;
}
.group{
display: flex;
align-items: center;
}
.cu-form-group .title{
font-size: 28upx;
color: #666;
}
.cu-bar .action:first-child {
font-size: 28upx;
}
.sp-text-center input{
text-align: center;
}
</style>