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

223 lines
6.1 KiB
Vue
Raw Normal View History

2024-01-16 17:24:49 +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="wui-form-list">
<view class="cu-form-group ">
<view class="title">分析时间</view>
2024-01-22 08:37:11 +08:00
<ruiDatePicker fields="minute"
2024-01-16 17:24:49 +08:00
: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_GAS" v-model="pd.ANALYZE_GAS" placeholder="请输入代表性气体"></input>
2024-01-16 17:24:49 +08:00
</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 class="title">分析地点</view>
<input name="input" ref="ANALYZE_PLACE" v-model="pd.ANALYZE_PLACE" placeholder="请输入"></input>
</view>
2024-01-16 17:24:49 +08:00
<view class="cu-form-group">
<view>
<text class="title">分析人</text>
<text>{{pd.ANALYZE_USER}}</text>
</view>
2024-01-22 08:37:11 +08:00
</view>
<view class="wui-sign" >
<view class="title"></view>
<button class="cu-btn bg-green shadow" @tap="showModal" data-target="Modal">手写签字</button>
</view>
2024-01-16 17:24:49 +08:00
2024-01-22 08:37:11 +08:00
<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>
2024-01-16 17:24:49 +08:00
</view>
</view>
<view class="cu-bar btn-group" style="margin-top: 30upx;">
2024-01-25 15:59:40 +08:00
<button :loading="buttonloading" class="cu-btn bg-red margin-tb-sm lg" @click="$noMultipleClicks(goSubmit(-1))"></button>
2024-01-22 17:29:29 +08:00
<button :loading="buttonloading" class="cu-btn bg-green margin-tb-sm lg" @click="$noMultipleClicks(goSubmit(1))"></button>
2024-01-16 17:24:49 +08:00
</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,
2024-01-22 08:37:11 +08:00
imgList:[],
modalName:null,
2024-01-16 17:24:49 +08:00
pd:{},// 数据
rules:[
{name:'ANALYZE_TIME',message:'请输入分析时间'},
{name:'ANALYZE_GAS',message:'请输入代表性气体'},
2024-01-16 17:24:49 +08:00
{name:'ANALYZE_RESULT',message:'请输入分析结果'},
2024-02-22 11:39:41 +08:00
{name:'ANALYZE_PLACE',message:'请输入分析地点'},
2024-01-16 17:24:49 +08:00
],
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: {
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)
})
},
2024-01-25 15:59:40 +08:00
2024-01-22 17:29:29 +08:00
goSubmit(APPLY_STATUS){
2024-01-16 17:24:49 +08:00
var _this = this;
let required = true
2024-01-22 08:37:11 +08:00
if (_this.imgList.length <= 0) {
uni.showToast({
icon: 'none',
title: '请签字',
duration: 1500
});
return;
}
2024-01-16 17:24:49 +08:00
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: '请稍候'
})
var files = [];
var signtime = [];
2024-01-22 08:37:11 +08:00
const formData={}
Object.keys(this.pd).map(key => {
formData[key]=this.pd[key]
})
this.uploadImgFaults(files,signtime)
formData.SIGNTIME = signtime
2024-01-22 08:37:11 +08:00
formData.CORPINFO_ID = loginUser.CORPINFO_ID
formData.USER_ID = loginUser.USER_ID
2024-01-22 17:29:29 +08:00
formData.APPLY_STATUS = APPLY_STATUS
2024-01-16 17:24:49 +08:00
this.buttonloading = true
2024-01-22 17:29:29 +08:00
uni.uploadFile({
2024-01-16 17:24:49 +08:00
url: basePath + "app/hotwork/gas/save",
files: files,
2024-01-22 08:37:11 +08:00
formData:formData,
2024-01-16 17:24:49 +08:00
success: (res) => {
uni.showToast({
icon:'none',
title: '保存成功',
duration: 2000
});
this.buttonloading = false
if(APPLY_STATUS === 1){
uni.navigateBack({delta: 1});
}else{
uni.navigateBack({delta: 2});
}
2024-01-25 15:59:40 +08:00
// _this.goback()
2024-01-16 17:24:49 +08:00
},
fail: (err) => {
uni.hideLoading();
uni.showModal({
content: err.errMsg,
showCancel: false
});
}
})
},
2024-01-22 08:37:11 +08:00
/*
2024-01-22 17:29:29 +08:00
*手写板
*/
2024-01-22 08:37:11 +08:00
showModal(e) {
this.modalName = e.currentTarget.dataset.target
},
hideModal(e) {
this.modalName = null
},
//完成
subCanvas(e) {
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) {
let files =[];
files.push(e.currentTarget.dataset.url)
uni.previewImage({
urls: files,
current: e.currentTarget.dataset.url
});
},
2024-01-22 17:29:29 +08:00
2024-01-16 17:24:49 +08:00
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>