<template> <view> <cu-custom bgColor="bg-gradual-blueness" :isBack="true"> <block slot="backText">返回</block> <block slot="content">气体分析</block> </cu-custom> <view style="text-align: right;"> <button class="cu-btn bg-blue margin-tb-sm sm" v-if="addState" @click="addModalShow">添加</button> </view> <view class="form" v-if="list.length>0"> <view class="wui-form-list" v-for="(item,index) in list" :key="index"> <view class="cu-form-group"> <view class="title">动火分析时间:</view> {{ item.GAS_TIME }} </view> <view class="cu-form-group"> <view class="title">分析点名称:</view> {{ item.GAS_NAME }} </view> <view class="cu-form-group"> <view class="title">分析数据(%LEL)</view> {{ item.GAS_NUMBER }} <view class="title">(%LEL)</view> </view> <view class="cu-form-group"> <view class="title">分析人</view> {{ item.userName }} </view> </view> </view> <view v-else-if="dataFlag=='noData'" class="dy-null"> <view class="dy-null-img"> <image :src="background[dataFlag].url" mode=""></image> </view> <view class="dy-null-title"> {{background[dataFlag].msg}} </view> </view> <view class="cu-tabbar-height"></view> <view class="padding flex flex-direction"></view> <view :class="['cu-modal',{'show':addModal}]"> <view class="cu-dialog"> <view class="cu-bar bg-white justify-end"> <view class="content">气体分析</view> <view class="action" @tap="addModal = false"> <text class="cuIcon-close text-red"></text> </view> </view> <view> <view class="wrapper"> <view class="handCenter"> <view class="form"> <view class="wui-form-list"> <view class="cu-form-group"> <view class="title">动火分析时间:</view> <ruiDatePicker :start="todayDate" fields="minute" :value="addForm.GAS_TIME || '请选择'" @change="changeApplicationDate"></ruiDatePicker> </view> <view class="cu-form-group"> <view class="title">分析点名称:</view> <input v-model="addForm.GAS_NAME" placeholder="请输入分析点名称"></input> </view> <view class="cu-form-group"> <view class="title">分析数据(%LEL):</view> <input type="number" v-model="addForm.GAS_NUMBER" placeholder="0"></input> <view class="title">(%LEL)</view> </view> <view class="cu-form-group"> <view class="title">分析人:</view> <input :disabled="true" v-model="addForm.gasUserName" placeholder="请输入分析人"></input> </view> </view> </view> </view> </view> </view> <view class="cu-bar bg-white justify-end"> <view class="action"> <button class="cu-btn bg-green margin-left" @click="confirmAdd()">提交</button> </view> </view> </view> </view> </view> </template> <script> import { basePath, loginUser, loginSession, formatDate, corpinfoId, loginUserId, baseImgPath } from '@/common/tool.js'; import sign from '@/components/sign/sign.vue'; import ruiDatePicker from '@/components/rattenking-dtpicker/rattenking-dtpicker.vue'; import tkiTree from "@/components/select-tree/select-tree.vue" export default { components: { sign, ruiDatePicker, tkiTree }, data() { return { noClick: true, dataFlag: 'noData', list: [], addModal:false, addForm:{ gasUserName:'', GAS_TIME:'', GAS_NAME:'', GAS_NUMBER:'', loginUserId:'', GAS_USER_ID:'', HOTWORKAPPLICATION_ID:'' }, todayDate: formatDate(new Date(), 'yyyy-MM-dd hh:mm'), taskModal:false, tkiTreeShow: false, STATE :'', addState :false } }, onLoad(event) { this.background = require('@/common/background.json'); this.STATE =event.state this.addForm.gasUserName = loginUser.NAME this.addForm.GAS_TIME = this.todayDate; this.addForm.loginUserId = loginUserId; this.addForm.GAS_USER_ID = loginUserId; this.addForm.HOTWORKAPPLICATION_ID = event.id; this.getData( event.id); loginSession(); }, methods: { getData(howWorkId) { var _this = this; uni.showLoading({ title: '请稍候' }) uni.request({ url: basePath + '/app/gasanalysis/list?showCount=1¤tPage=20', method: 'POST', header: { 'Content-type': 'application/x-www-form-urlencoded' }, data: { HOTWORKAPPLICATION_ID: howWorkId, loginUserId: this.addForm.loginUserId }, success: (res) => { if ("success" == res.data.result) { this.list = res.data.varList if(res.data.gasUser.USER_ID && res.data.howWork.STATE !='11'){ this.addState = true } uni.hideLoading(); } else if ("exception" == res.data.result) { uni.showToast({ title: '错误', duration: 2000 }); } } }); }, addModalShow(){ this.addModal = true; this.addForm.GAS_NAME = '' this.addForm.GAS_NUMBER = '' }, confirmAdd(){ var _this = this; uni.showLoading({ title: '请稍候' }) uni.request({ url: basePath+'/app/gasanalysis/add', data: { "gasUserName": _this.addForm.gasUserName, "GAS_TIME":_this.addForm.GAS_TIME, "GAS_NAME":_this.addForm.GAS_NAME, "GAS_NUMBER": _this.addForm.GAS_NUMBER, "loginUserId": _this.addForm.loginUserId, "GAS_USER_ID": _this.addForm.GAS_USER_ID, "HOTWORKAPPLICATION_ID": _this.addForm.HOTWORKAPPLICATION_ID, "gasTime": _this.addForm.gasTime, }, success: (res) => { uni.hideLoading(); this.addModal = false this.getData(_this.addForm.HOTWORKAPPLICATION_ID) uni.showToast({ icon: 'none', title: '添加成功', duration: 2000 }); }, fail: (err) => { uni.hideLoading(); uni.showModal({ content: err.errMsg, showCancel: false }); } }) }, changeApplicationDate(e) { this.addForm.GAS_TIME = e }, goback() { uni.navigateBack({ delta: 1 }); uni.hideLoading(); }, } } </script> <style> .cu-modal{ z-index: 0; } </style>