integrated_traffic_uniapp/pages/application/hotwork/hotwork-gas/gas-detail.vue

151 lines
3.8 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 ">
<view class="title">分析时间</view>
<ruiDatePicker v-if="!forbidEdit"
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_PLACE" v-model="pd.ANALYZE_PLACE" placeholder="请输入代表性气体"></input>
</view>
<view class="cu-form-group">
<view class="title">分析结果:</view>
<input name="input" ref="ANALYZE_RESULT" v-model="pd.ANALYZE_RESULT" placeholder="请输入"></input>
</view>
<view class="cu-form-group">
<view>
<text class="title">分析人:</text>
<text>{{pd.ANALYZE_USER}}</text>
</view>
</view>
</view>
</view>
<view class="cu-bar btn-group" style="margin-top: 30upx;">
<button :loading="buttonloading" class="cu-btn bg-green margin-tb-sm lg" @click="$noMultipleClicks(goSubmit)">保存</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';
export default {
components: {
tkiTree,ruiDatePicker,writingBoard
},
data() {
return {
noClick:true,
buttonloading: false,
pd:{},// 数据
rules:[
{name:'ANALYZE_TIME',message:'请输入分析时间'},
{name:'ANALYZE_PLACE',message:'请输入分析点'},
{name:'ANALYZE_RESULT',message:'请输入分析结果'},
],
currentTime:formatDate(new Date(),'yyyy-MM-dd hh:mm')
}
},
onLoad(event){
this.pd.HOTWORK_ID = event.HOTWORK_ID;
this.pd.ANALYZE_USER = loginUser.NAME;
loginSession();
},
methods: {
goSubmit(){
var _this = this;
let required = true
this.rules.map(({name,message}) => {
if (!this.pd[name]) {
uni.showToast({
icon: 'none',
title: message,
duration: 1500
});
required = false
}
})
if (!required) {
return
}
uni.showLoading({
title: '请稍候'
})
this.buttonloading = true
uni.request({
url: basePath + "app/hotwork/gas/save",
method: 'POST',
dataType: 'json',
header:{
'Content-type':'application/x-www-form-urlencoded'
},
data: {
..._this.pd,
CORPINFO_ID:loginUser.CORPINFO_ID,
USER_ID:loginUser.USER_ID,
},
success: (res) => {
uni.showToast({
icon:'none',
title: '保存成功',
duration: 2000
});
this.buttonloading = false
_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>
</style>