|
@@ -9,7 +9,8 @@
|
|
|
style="margin: 2px 0px;">图片选取</u-button>
|
|
|
<!-- 图片预览 -->
|
|
|
<view class="imgView">
|
|
|
- <image v-if="imageSrc" style="width:300px;" :src="imageSrc" mode="aspectFit" @click="getPreview">
|
|
|
+ <image v-if="saveImg || imageSrc" style="width:300px;" :src="imageSrc ? imageSrc : saveImg"
|
|
|
+ mode="aspectFit" @click="getPreview">
|
|
|
</image>
|
|
|
</view>
|
|
|
|
|
@@ -109,13 +110,11 @@
|
|
|
:placeholder="isRule3 ? '请输入' : '数据有误'" type="number" v-model="formState.bxy" clearable
|
|
|
@blur="getBlurBxy" @input="changeInput($event, 'bxy')"></u--input>
|
|
|
</view>
|
|
|
-
|
|
|
</view>
|
|
|
</view>
|
|
|
-
|
|
|
<view class="dialog-btn">
|
|
|
- <u-button type="success" v-if="statusShow == 'add'" size="small" @click="getConfirm">保存</u-button>
|
|
|
- <u-button type="success" size="small" v-if="statusShow == 'edit'" @click="getConfirm">保存</u-button>
|
|
|
+ <u-button type="success" v-if="statusShow == 'add' || statusShow == 'edit'" size="small"
|
|
|
+ @click="getConfirm">保存</u-button>
|
|
|
<u-button type="primary" size="small" @click="getCancel">取消</u-button>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -127,7 +126,7 @@
|
|
|
import api from "@/api/api";
|
|
|
import moment from 'moment'
|
|
|
import configService from '@/common/service/config.service.js'
|
|
|
-import { RHFselcet } from '@/uni_modules/fz-media-selcet';
|
|
|
+// import { RHFselcet } from '@/uni_modules/fz-media-selcet';
|
|
|
import helangCompress from '@/components/helang-compress/helang-compress';
|
|
|
export default {
|
|
|
name: 'gasFill',
|
|
@@ -164,6 +163,10 @@ export default {
|
|
|
checkState: {
|
|
|
type: String,
|
|
|
default: ''
|
|
|
+ },
|
|
|
+ saveImg: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -173,24 +176,6 @@ export default {
|
|
|
gasTitle: '数据采集',//标题
|
|
|
backPic0: "url(/static/topnavbar0.png)",
|
|
|
backPic: "url(../../static/topnavbar.png)",
|
|
|
- //双指缩放信息
|
|
|
- scaleImg: 1, // 初始图片缩放比例
|
|
|
- lastDistance: 0, // 上一次的缩放距离
|
|
|
- animationTime: 0.5, // 动画时间
|
|
|
- fingers: false, // 是否是双指操作
|
|
|
- move: {
|
|
|
- x: 0, // 手指水平移动距离
|
|
|
- y: 0, // 手指垂直移动距离
|
|
|
- },
|
|
|
- offset: {
|
|
|
- x: 0, // 水平偏移量
|
|
|
- y: 0, // 垂直偏移量
|
|
|
- },
|
|
|
- imgLocation: {
|
|
|
- x: 0, // 水平位置
|
|
|
- y: 0, // 垂直位置
|
|
|
- },
|
|
|
- isFirst: true, // 是否是第一次缩放
|
|
|
loading: false,
|
|
|
paramData: {},
|
|
|
statusShow: '',
|
|
@@ -329,11 +314,11 @@ export default {
|
|
|
getPreview() {
|
|
|
// 预览图片
|
|
|
uni.previewImage({
|
|
|
- urls: this.tempFilePaths,
|
|
|
+ urls: this.saveImg ? [this.saveImg] : this.tempFilePaths,
|
|
|
current: 0
|
|
|
});
|
|
|
},
|
|
|
- //压缩图片
|
|
|
+ //先压缩后识别
|
|
|
getScale() {
|
|
|
let that = this
|
|
|
// 单张压缩
|
|
@@ -360,6 +345,7 @@ export default {
|
|
|
'reportdate': that.searchTime,
|
|
|
'checkorder': jcNum ? jcNum : Number(that.checkNum)
|
|
|
},
|
|
|
+
|
|
|
success: (res) => {
|
|
|
if (res) {
|
|
|
uni.showToast({
|
|
@@ -668,20 +654,337 @@ export default {
|
|
|
that.loading = false
|
|
|
})
|
|
|
},
|
|
|
+ //直接识别
|
|
|
+ getIdentyfe() {
|
|
|
+ let that = this
|
|
|
+ that.loading = true
|
|
|
+ let jcNum = that.deviceName.indexOf('第三次') != -1 ? 3 : null
|
|
|
+ let apiUrlImg = `${configService.apiUrlP.substring(0, configService.apiUrlP.lastIndexOf(':'))}:6006`
|
|
|
+ uni.uploadFile({
|
|
|
+ url: `${apiUrlImg}/gasIdentify`,
|
|
|
+ filePath: that.saveImg,
|
|
|
+ name: 'img',
|
|
|
+ formData: {
|
|
|
+ 'user': that.username,
|
|
|
+ 'order': that.classType,
|
|
|
+ 'reportdate': that.searchTime,
|
|
|
+ 'checkorder': jcNum ? jcNum : Number(that.checkNum)
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ if (res) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '识别成功!',
|
|
|
+ icon: 'none' // 可选图标,'success', 'loading', 'none'
|
|
|
+ });
|
|
|
+ that.indexList = JSON.parse(res.data).data || []
|
|
|
+ that.isShowAdd = true
|
|
|
+ that.loading = false
|
|
|
+ that.isShowAdd = true
|
|
|
+ that.statusShow = 'add'
|
|
|
+ that.deviceId = that.deviceID
|
|
|
+
|
|
|
+ if (that.indexList.length != 0) {
|
|
|
+ that.indexParam = that.indexList[0]
|
|
|
+ that.formState = {
|
|
|
+ id: '',
|
|
|
+ bc: that.classType || '',
|
|
|
+ count: that.checkNum == '1' ? '第一次' : that.checkNum == '2' ? '第二次' : '',
|
|
|
+ jcdd: that.deviceName || '',
|
|
|
+ jcy: that.indexParam && that.indexParam['检查人'] ? that.indexParam['检查人'] : that.username,
|
|
|
+ time: that.indexParam && that.indexParam['检查时间'] ? that.indexParam['检查时间'] : '',
|
|
|
+ ch4: that.indexParam && that.indexParam['CH4%'] ? that.indexParam['CH4%'] : '',
|
|
|
+ co2: that.indexParam && that.indexParam['CO2%'] ? that.indexParam['CO2%'] : '',
|
|
|
+ co: that.indexParam && that.indexParam['CO(ppm)'] ? that.indexParam['CO(ppm)'] : '',
|
|
|
+ o2: that.indexParam && that.indexParam['O2%'] ? that.indexParam['O2%'] : '',
|
|
|
+ jw: that.isSensor == '1' ? '0' : '-',
|
|
|
+ bxy: '0',
|
|
|
+ tbrq: that.indexParam && that.indexParam['检查时间'] ? that.indexParam['检查时间'].substring(0, that.indexParam['检查时间'].indexOf(' ')) : '',
|
|
|
+ temp: that.indexParam && that.indexParam['温度(℃)'] ? that.indexParam['温度(℃)'] : '',
|
|
|
+ }
|
|
|
+
|
|
|
+ new Promise((resolve, reject) => {
|
|
|
+ api
|
|
|
+ .getGas({ reportTime: that.formState.tbrq, deviceId: that.deviceId })
|
|
|
+ .then((response) => {
|
|
|
+ if (response.data.code == 200) {
|
|
|
+ let data = response.data.result.records
|
|
|
+ if (data.length != 0) {
|
|
|
+ that.saveShowList = data[0]
|
|
|
+ if (that.formState.bc == '早班' && that.formState.count == '第一次') {
|
|
|
+ let param = {
|
|
|
+ taskDetailsId: that.Ids,
|
|
|
+ deviceId: that.deviceId,
|
|
|
+ bxySdzEarly1: that.formState.bxy,
|
|
|
+ ch4Early1: that.formState.ch4,
|
|
|
+ checkPersonEarly: that.formState.jcy,
|
|
|
+ co2Early1: that.formState.co2,
|
|
|
+ coEarly1: that.formState.co,
|
|
|
+ gwSdzEarly1: that.formState.ch4,
|
|
|
+ jwSdzEarly1: that.formState.jw,
|
|
|
+ o2Early1: that.formState.o2,
|
|
|
+ strInstallPos: that.formState.jcdd,
|
|
|
+ timeEarly1: that.formState.time,
|
|
|
+ reportTime: that.formState.tbrq,
|
|
|
+ tearly1: that.formState.temp,
|
|
|
+ }
|
|
|
+ that.paramData = Object.assign({}, that.saveShowList, param)
|
|
|
+ } else if (that.formState.bc == '早班' && that.formState.count == '第二次') {
|
|
|
+ let param = {
|
|
|
+ taskDetailsId: that.Ids,
|
|
|
+ deviceId: that.deviceId,
|
|
|
+ bxySdzEarly2: that.formState.bxy,
|
|
|
+ ch4Early2: that.formState.ch4,
|
|
|
+ checkPersonEarly: that.formState.jcy,
|
|
|
+ co2Early2: that.formState.co2,
|
|
|
+ coEarly2: that.formState.co,
|
|
|
+ gwSdzEarly2: that.formState.ch4,
|
|
|
+ jwSdzEarly2: that.formState.jw,
|
|
|
+ o2Early2: that.formState.o2,
|
|
|
+ strInstallPos: that.formState.jcdd,
|
|
|
+ timeEarly2: that.formState.time,
|
|
|
+ reportTime: that.formState.tbrq,
|
|
|
+ tearly2: that.formState.temp,
|
|
|
+ }
|
|
|
+ that.paramData = Object.assign({}, that.saveShowList, param)
|
|
|
+ } else if (that.formState.bc == '中班' && that.formState.count == '第一次') {
|
|
|
+ let param = {
|
|
|
+ taskDetailsId: that.Ids,
|
|
|
+ deviceId: that.deviceId,
|
|
|
+ bxySdzNoon1: that.formState.bxy,
|
|
|
+ ch4Noon1: that.formState.ch4,
|
|
|
+ checkPersonNoon: that.formState.jcy,
|
|
|
+ co2Noon1: that.formState.co2,
|
|
|
+ coNoon1: that.formState.co,
|
|
|
+ gwSdzNoon1: that.formState.ch4,
|
|
|
+ jwSdzNoon1: that.formState.jw,
|
|
|
+ o2Noon1: that.formState.o2,
|
|
|
+ strInstallPos: that.formState.jcdd,
|
|
|
+ timeNoon1: that.formState.time,
|
|
|
+ reportTime: that.formState.tbrq,
|
|
|
+ tnoon1: that.formState.temp,
|
|
|
+ }
|
|
|
+ that.paramData = Object.assign({}, that.saveShowList, param)
|
|
|
+ } else if (that.formState.bc == '中班' && that.formState.count == '第二次') {
|
|
|
+ let param = {
|
|
|
+ taskDetailsId: that.Ids,
|
|
|
+ deviceId: that.deviceId,
|
|
|
+ bxySdzNoon2: that.formState.bxy,
|
|
|
+ ch4Noon2: that.formState.ch4,
|
|
|
+ checkPersonNoon: that.formState.jcy,
|
|
|
+ co2Noon2: that.formState.co2,
|
|
|
+ coNoon2: that.formState.co,
|
|
|
+ gwSdzNoon2: that.formState.ch4,
|
|
|
+ jwSdzNoon2: that.formState.jw,
|
|
|
+ o2Noon2: that.formState.o2,
|
|
|
+ strInstallPos: that.formState.jcdd,
|
|
|
+ timeNoon2: that.formState.time,
|
|
|
+ reportTime: that.formState.tbrq,
|
|
|
+ tnoon2: that.formState.temp,
|
|
|
+ }
|
|
|
+ that.paramData = Object.assign({}, that.saveShowList, param)
|
|
|
+ } else if (that.formState.bc == '夜班' && that.formState.count == '第一次') {
|
|
|
+ let param = {
|
|
|
+ taskDetailsId: that.Ids,
|
|
|
+ deviceId: that.deviceId,
|
|
|
+ bxySdzNight1: that.formState.bxy,
|
|
|
+ ch4Night1: that.formState.ch4,
|
|
|
+ checkPersonNight: that.formState.jcy,
|
|
|
+ co2Night1: that.formState.co2,
|
|
|
+ coNight1: that.formState.co,
|
|
|
+ gwSdzNight1: that.formState.ch4,
|
|
|
+ jwSdzNight1: that.formState.jw,
|
|
|
+ o2Night1: that.formState.o2,
|
|
|
+ strInstallPos: that.formState.jcdd,
|
|
|
+ timeNight1: that.formState.time,
|
|
|
+ reportTime: that.formState.tbrq,
|
|
|
+ tnight1: that.formState.temp,
|
|
|
+ }
|
|
|
+ that.paramData = Object.assign({}, that.saveShowList, param)
|
|
|
+ } else if (that.formState.bc == '夜班' && that.formState.count == '第二次') {
|
|
|
+ let param = {
|
|
|
+ taskDetailsId: that.Ids,
|
|
|
+ deviceId: that.deviceId,
|
|
|
+ bxySdzNight2: that.formState.bxy,
|
|
|
+ ch4Night2: that.formState.ch4,
|
|
|
+ checkPersonNight: that.formState.jcy,
|
|
|
+ co2Night2: that.formState.co2,
|
|
|
+ coNight2: that.formState.co,
|
|
|
+ gwSdzNight2: that.formState.ch4,
|
|
|
+ jwSdzNight2: that.formState.jw,
|
|
|
+ o2Night2: that.formState.o2,
|
|
|
+ strInstallPos: that.formState.jcdd,
|
|
|
+ timeNight2: that.formState.time,
|
|
|
+ reportTime: that.formState.tbrq,
|
|
|
+ tnight2: that.formState.temp,
|
|
|
+ }
|
|
|
+ that.paramData = Object.assign({}, that.saveShowList, param)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ that.saveShowList = {}
|
|
|
+ if (that.formState.bc == '早班' && that.formState.count == '第一次') {
|
|
|
+ let param = {
|
|
|
+ taskDetailsId: that.Ids,
|
|
|
+ deviceId: that.deviceId,
|
|
|
+ bxySdzEarly1: that.formState.bxy,
|
|
|
+ ch4Early1: that.formState.ch4,
|
|
|
+ checkPersonEarly: that.formState.jcy,
|
|
|
+ co2Early1: that.formState.co2,
|
|
|
+ coEarly1: that.formState.co,
|
|
|
+ gwSdzEarly1: that.formState.ch4,
|
|
|
+ jwSdzEarly1: that.formState.jw,
|
|
|
+ o2Early1: that.formState.o2,
|
|
|
+ strInstallPos: that.formState.jcdd,
|
|
|
+ timeEarly1: that.formState.time,
|
|
|
+ reportTime: that.formState.tbrq,
|
|
|
+ tearly1: that.formState.temp,
|
|
|
+ }
|
|
|
+ that.paramData = Object.assign({}, that.saveShowList, param)
|
|
|
+ } else if (that.formState.bc == '早班' && that.formState.count == '第二次') {
|
|
|
+ let param = {
|
|
|
+ taskDetailsId: that.Ids,
|
|
|
+ deviceId: that.deviceId,
|
|
|
+ bxySdzEarly2: that.formState.bxy,
|
|
|
+ ch4Early2: that.formState.ch4,
|
|
|
+ checkPersonEarly: that.formState.jcy,
|
|
|
+ co2Early2: that.formState.co2,
|
|
|
+ coEarly2: that.formState.co,
|
|
|
+ gwSdzEarly2: that.formState.ch4,
|
|
|
+ jwSdzEarly2: that.formState.jw,
|
|
|
+ o2Early2: that.formState.o2,
|
|
|
+ strInstallPos: that.formState.jcdd,
|
|
|
+ timeEarly2: that.formState.time,
|
|
|
+ reportTime: that.formState.tbrq,
|
|
|
+ tearly2: that.formState.temp,
|
|
|
+ }
|
|
|
+ that.paramData = Object.assign({}, that.saveShowList, param)
|
|
|
+ } else if (that.formState.bc == '中班' && that.formState.count == '第一次') {
|
|
|
+ let param = {
|
|
|
+ taskDetailsId: that.Ids,
|
|
|
+ deviceId: that.deviceId,
|
|
|
+ bxySdzNoon1: that.formState.bxy,
|
|
|
+ ch4Noon1: that.formState.ch4,
|
|
|
+ checkPersonNoon: that.formState.jcy,
|
|
|
+ co2Noon1: that.formState.co2,
|
|
|
+ coNoon1: that.formState.co,
|
|
|
+ gwSdzNoon1: that.formState.ch4,
|
|
|
+ jwSdzNoon1: that.formState.jw,
|
|
|
+ o2Noon1: that.formState.o2,
|
|
|
+ strInstallPos: that.formState.jcdd,
|
|
|
+ timeNoon1: that.formState.time,
|
|
|
+ reportTime: that.formState.tbrq,
|
|
|
+ tnoon1: that.formState.temp,
|
|
|
+ }
|
|
|
+ that.paramData = Object.assign({}, that.saveShowList, param)
|
|
|
+ } else if (that.formState.bc == '中班' && that.formState.count == '第二次') {
|
|
|
+ let param = {
|
|
|
+ taskDetailsId: that.Ids,
|
|
|
+ deviceId: that.deviceId,
|
|
|
+ bxySdzNoon2: that.formState.bxy,
|
|
|
+ ch4Noon2: that.formState.ch4,
|
|
|
+ checkPersonNoon: that.formState.jcy,
|
|
|
+ co2Noon2: that.formState.co2,
|
|
|
+ coNoon2: that.formState.co,
|
|
|
+ gwSdzNoon2: that.formState.ch4,
|
|
|
+ jwSdzNoon2: that.formState.jw,
|
|
|
+ o2Noon2: that.formState.o2,
|
|
|
+ strInstallPos: that.formState.jcdd,
|
|
|
+ timeNoon2: that.formState.time,
|
|
|
+ reportTime: that.formState.tbrq,
|
|
|
+ tnoon2: that.formState.temp,
|
|
|
+ }
|
|
|
+ that.paramData = Object.assign({}, that.saveShowList, param)
|
|
|
+ } else if (that.formState.bc == '夜班' && that.formState.count == '第一次') {
|
|
|
+ let param = {
|
|
|
+ taskDetailsId: that.Ids,
|
|
|
+ deviceId: that.deviceId,
|
|
|
+ bxySdzNight1: that.formState.bxy,
|
|
|
+ ch4Night1: that.formState.ch4,
|
|
|
+ checkPersonNight: that.formState.jcy,
|
|
|
+ co2Night1: that.formState.co2,
|
|
|
+ coNight1: that.formState.co,
|
|
|
+ gwSdzNight1: that.formState.ch4,
|
|
|
+ jwSdzNight1: that.formState.jw,
|
|
|
+ o2Night1: that.formState.o2,
|
|
|
+ strInstallPos: that.formState.jcdd,
|
|
|
+ timeNight1: that.formState.time,
|
|
|
+ reportTime: that.formState.tbrq,
|
|
|
+ tnight1: that.formState.temp,
|
|
|
+ }
|
|
|
+ that.paramData = Object.assign({}, that.saveShowList, param)
|
|
|
+ } else if (that.formState.bc == '夜班' && that.formState.count == '第二次') {
|
|
|
+ let param = {
|
|
|
+ taskDetailsId: that.Ids,
|
|
|
+ deviceId: that.deviceId,
|
|
|
+ bxySdzNight2: that.formState.bxy,
|
|
|
+ ch4Night2: that.formState.ch4,
|
|
|
+ checkPersonNight: that.formState.jcy,
|
|
|
+ co2Night2: that.formState.co2,
|
|
|
+ coNight2: that.formState.co,
|
|
|
+ gwSdzNight2: that.formState.ch4,
|
|
|
+ jwSdzNight2: that.formState.jw,
|
|
|
+ o2Night2: that.formState.o2,
|
|
|
+ strInstallPos: that.formState.jcdd,
|
|
|
+ timeNight2: that.formState.time,
|
|
|
+ reportTime: that.formState.tbrq,
|
|
|
+ tnight2: that.formState.temp,
|
|
|
+ }
|
|
|
+ that.paramData = Object.assign({}, that.saveShowList, param)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ reject(response);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ console.log("catch===>response", response);
|
|
|
+ reject(error);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ that.formState = {
|
|
|
+ id: '',
|
|
|
+ bc: that.classType || '',
|
|
|
+ count: that.checkNum == '1' ? '第一次' : that.checkNum == '2' ? '第二次' : '',
|
|
|
+ jcdd: that.deviceName || '',
|
|
|
+ jcy: that.username,
|
|
|
+ time: '',
|
|
|
+ ch4: '',
|
|
|
+ co2: '',
|
|
|
+ co: '',
|
|
|
+ o2: '',
|
|
|
+ jw: that.isSensor == '1' ? '0' : '-',
|
|
|
+ bxy: '0',
|
|
|
+ tbrq: '',
|
|
|
+ temp: '',
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: (error) => {
|
|
|
+ uni.showToast({
|
|
|
+ title: '识别失败!',
|
|
|
+ icon: 'none' // 可选图标,'success', 'loading', 'none'
|
|
|
+ });
|
|
|
+ that.loading = false
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
//获取图片识别数据
|
|
|
getGasIdentify() {
|
|
|
let that = this
|
|
|
if (that.imageSrc) {
|
|
|
that.getScale()
|
|
|
+ } else if (that.saveImg) {
|
|
|
+ that.getIdentyfe()
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: '请选择上传图片!',
|
|
|
icon: 'none' // 可选图标,'success', 'loading', 'none'
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
},
|
|
|
// // 选择图片的方法
|
|
|
// chooseImage() {
|
|
@@ -708,6 +1011,7 @@ export default {
|
|
|
this.indexList = []
|
|
|
this.indexParam = {}
|
|
|
this.imageSrc = ''
|
|
|
+ that.$emit('clearImg', true)
|
|
|
},
|
|
|
|
|
|
|
|
@@ -1292,7 +1596,6 @@ export default {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
},
|
|
|
//便携仪失去焦点时参数校验
|
|
@@ -1380,6 +1683,7 @@ export default {
|
|
|
that.indexParam = {}
|
|
|
that.imageSrc = ''
|
|
|
that.clearData()
|
|
|
+ that.$emit('clearImg', true)
|
|
|
that.$emit('getBackAddress')
|
|
|
} else {
|
|
|
reject(response);
|
|
@@ -1864,7 +2168,6 @@ export default {
|
|
|
flag = true
|
|
|
}
|
|
|
})
|
|
|
- console.log(flag)
|
|
|
if (that.statusShow == 'add') {
|
|
|
if (flag) {
|
|
|
uni.showToast({
|